public static interface PwHash.Lazy
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
cryptoPwHash(java.lang.String password,
int cryptoPwHashLen,
byte[] salt,
long opsLimit,
com.sun.jna.NativeLong memLimit,
PwHash.Alg alg)
Hashes a given password.
|
java.lang.String |
cryptoPwHashStr(java.lang.String password,
long opsLimit,
com.sun.jna.NativeLong memLimit)
The most minimal way of hashing a given password.
|
java.lang.String |
cryptoPwHashStrRemoveNulls(java.lang.String password,
long opsLimit,
com.sun.jna.NativeLong memLimit)
Hashes a string and removes all the null bytes.
|
boolean |
cryptoPwHashStrVerify(java.lang.String hash,
java.lang.String password)
Verifies a password.
|
java.lang.String cryptoPwHash(java.lang.String password,
int cryptoPwHashLen,
byte[] salt,
long opsLimit,
com.sun.jna.NativeLong memLimit,
PwHash.Alg alg)
throws SodiumException
cryptoPwHashLen - The hash size that you want.
Anything between PwHash.BYTES_MIN and PwHash.BYTES_MAXpassword - The password to hash.salt - A salt to use with the hash, generated randomly.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. Defaults to PwHash.Alg.PWHASH_ALG_ARGON2ID13.SodiumException - If the password is too short or the opsLimit is not correct.java.lang.String cryptoPwHashStr(java.lang.String password,
long opsLimit,
com.sun.jna.NativeLong memLimit)
throws SodiumException
PwHash.Alg.password - The password string to hash.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.SodiumException - If the password could not be hashed.java.lang.String cryptoPwHashStrRemoveNulls(java.lang.String password,
long opsLimit,
com.sun.jna.NativeLong memLimit)
throws SodiumException
PwHash.Alg.password - The password string to hash.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.SodiumException - If the password could not be hashed.boolean cryptoPwHashStrVerify(java.lang.String hash,
java.lang.String password)
hash - The hash. Must be hexadecimal Helpers.Lazy.sodiumBin2Hex(byte[]).password - The password.