public static interface PwHash.Native
| Modifier and Type | Method and Description |
|---|---|
boolean |
cryptoPwHash(byte[] outputHash,
int outputHashLen,
byte[] password,
int passwordLen,
byte[] salt,
long opsLimit,
com.sun.jna.NativeLong memLimit,
PwHash.Alg alg)
Based on a password you provide, hash that
password and put the output into
outputHash. |
boolean |
cryptoPwHashStr(byte[] outputStr,
byte[] password,
int passwordLen,
long opsLimit,
com.sun.jna.NativeLong memLimit)
Hashes a password and stores it into an array.
|
boolean |
cryptoPwHashStrNeedsRehash(byte[] hash,
long opsLimit,
com.sun.jna.NativeLong memLimit)
Checks whether the hash needs a rehash.
|
boolean |
cryptoPwHashStrVerify(byte[] hash,
byte[] password,
int passwordLen)
Verifies a hashed password.
|
boolean cryptoPwHash(byte[] outputHash,
int outputHashLen,
byte[] password,
int passwordLen,
byte[] salt,
long opsLimit,
com.sun.jna.NativeLong memLimit,
PwHash.Alg alg)
outputHash.
Take note that the output of this does NOT output a traditional
Argon 2 string as the underlying native implementation calls argon2id_hash_raw
instead of argon2id_hash_encoded. If you want an Argon 2 encoded string please refer
to cryptoPwHashStr(byte[], byte[], int, long, NativeLong) instead.outputHash - Where to store the resulting password hash.outputHashLen - The password hash's length. Must be at least PwHash.BYTES_MIN.password - The password that you want to hash.passwordLen - The length of the password's bytes.salt - A salt that's randomly generated.opsLimit - The number of cycles to perform whilst hashing.
Between PwHash.OPSLIMIT_MIN and PwHash.OPSLIMIT_MAX.memLimit - The amount of memory to use.
Between PwHash.MEMLIMIT_MIN and PwHash.MEMLIMIT_MAX.alg - The algorithm to use. Please use PwHash.Alg.PWHASH_ALG_ARGON2ID13 for now.boolean cryptoPwHashStr(byte[] outputStr,
byte[] password,
int passwordLen,
long opsLimit,
com.sun.jna.NativeLong memLimit)
outputStr - An array to hold the hash. Must be at least PwHash.STR_BYTES.password - A password that you want to hash.passwordLen - The password's byte length.opsLimit - The number of cycles to perform whilst hashing.
Between PwHash.OPSLIMIT_MIN and PwHash.OPSLIMIT_MAX.memLimit - The amount of memory to use.
Between PwHash.MEMLIMIT_MIN and PwHash.MEMLIMIT_MAX.cryptoPwHashStrVerify(byte[], byte[], int)boolean cryptoPwHashStrVerify(byte[] hash,
byte[] password,
int passwordLen)
hash - The hash of the password.password - The password to check if it equals the hash's password.passwordLen - The checking password's length.boolean cryptoPwHashStrNeedsRehash(byte[] hash,
long opsLimit,
com.sun.jna.NativeLong memLimit)
hash - The hash.opsLimit - The operations limit used.memLimit - The memory limit used.