crypto / org.apache.tuweni.crypto.sodium / PasswordHash / needsRehash

needsRehash

static fun needsRehash(hash: String): Boolean (source)

Check if a hash needs to be regenerated using limits on operations and memory that are suitable for most use-cases.

Equivalent to needsRehash(hash, moderateOpsLimit(), moderateMemLimit()).

Note: only supported when the sodium native library version >= 10.0.14 is available.

Parameters

hash - The hash.

Return
true if the hash should be regenerated.

static fun needsRehash(hash: String, opsLimit: Long, memLimit: Long): Boolean (source)

Check if a hash needs to be regenerated.

Check if a hash matches the parameters opslimit and memlimit, and the current default algorithm.

Note: only supported when the sodium native library version >= 10.0.14 is available.

Parameters

hash - The hash.

opsLimit - The operations limit, which must be in the range #minOpsLimit() to #maxOpsLimit().

memLimit - The memory limit, which must be in the range #minMemLimit() to #maxMemLimit().

Return
true if the hash should be regenerated.