Package 

Interface PwHash.Native

    • Method Summary

      Modifier and Type Method Description
      abstract boolean cryptoPwHash(Array<byte> outputHash, int outputHashLen, Array<byte> password, int passwordLen, Array<byte> salt, long opsLimit, NativeLong memLimit, PwHash.Alg alg) Based on a password you provide, hash thatpassword and put the output into {@code outputHash}.Take note that the output of this does NOT output a traditionalArgon 2 string as the underlying native implementation calls argon2id_hash_rawinstead of argon2id_hash_encoded.
      abstract boolean cryptoPwHashStr(Array<byte> outputStr, Array<byte> password, int passwordLen, long opsLimit, NativeLong memLimit) Hashes a password and stores it into an array.
      abstract boolean cryptoPwHashStrVerify(Array<byte> hash, Array<byte> password, int passwordLen) Verifies a hashed password.
      abstract PwHash.NeedsRehashResult cryptoPwHashStrNeedsRehash(Array<byte> hash, long opsLimit, NativeLong memLimit) Checks whether the hash needs a rehash.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • cryptoPwHash

         abstract boolean cryptoPwHash(Array<byte> outputHash, int outputHashLen, Array<byte> password, int passwordLen, Array<byte> salt, long opsLimit, NativeLong memLimit, PwHash.Alg alg)

        Based on a password you provide, hash thatpassword and put the output into {@code outputHash}.Take note that the output of this does NOT output a traditionalArgon 2 string as the underlying native implementation calls argon2id_hash_rawinstead of argon2id_hash_encoded. If you want an Argon 2 encoded string please referto cryptoPwHashStr instead.

        Parameters:
        outputHash - Where to store the resulting password hash.
        outputHashLen - The password hash's length.
        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.
        memLimit - The amount of memory to use.
        alg - The algorithm to use.
      • cryptoPwHashStr

         abstract boolean cryptoPwHashStr(Array<byte> outputStr, Array<byte> password, int passwordLen, long opsLimit, NativeLong memLimit)

        Hashes a password and stores it into an array. The output isan ASCII encoded string in a byte array.

        Parameters:
        outputStr - An array to hold the hash.
        password - A password that you want to hash.
        passwordLen - The password's byte length.
        opsLimit - The number of cycles to perform whilst hashing.
        memLimit - The amount of memory to use.
      • cryptoPwHashStrVerify

         abstract boolean cryptoPwHashStrVerify(Array<byte> hash, Array<byte> password, int passwordLen)

        Verifies a hashed password. Remember: you must adda null byte to the end of the hash so that this works properly!

        Parameters:
        hash - The hash of the password.
        password - The password to check if it equals the hash's password.
        passwordLen - The checking password's length.
      • cryptoPwHashStrNeedsRehash

         abstract PwHash.NeedsRehashResult cryptoPwHashStrNeedsRehash(Array<byte> hash, long opsLimit, NativeLong memLimit)

        Checks whether the hash needs a rehash.

        Parameters:
        hash - The hash.
        opsLimit - The operations limit used.
        memLimit - The memory limit used.