Interface Argon2Library

  • All Superinterfaces:
    com.sun.jna.Library

    public interface Argon2Library
    extends com.sun.jna.Library
    JNA bindings for Argon2.
    • Field Detail

      • INSTANCE

        static final Argon2Library INSTANCE
        Singleton instance.
      • ARGON2_OK

        static final int ARGON2_OK
        Return code if everything is okay.
        See Also:
        Constant Field Values
    • Method Detail

      • argon2i_hash_encoded

        int argon2i_hash_encoded​(JnaUint32 t_cost,
                                 JnaUint32 m_cost,
                                 JnaUint32 parallelism,
                                 byte[] pwd,
                                 Size_t pwdlen,
                                 byte[] salt,
                                 Size_t saltlen,
                                 Size_t hashlen,
                                 byte[] encoded,
                                 Size_t encodedlen)
        Hashes a password with Argon2i, producing an encoded hash.
        Parameters:
        t_cost - Number of iterations
        m_cost - Sets memory usage to m_cost kibibytes
        parallelism - Number of threads and compute lanes
        pwd - Pointer to password
        pwdlen - Password size in bytes
        salt - Pointer to salt
        saltlen - Salt size in bytes
        hashlen - Desired length of the hash in bytes
        encoded - Buffer where to write the encoded hash
        encodedlen - Size of the buffer (thus max size of the encoded hash)
        Returns:
        ARGON2_OK if successful
      • argon2id_hash_encoded

        int argon2id_hash_encoded​(JnaUint32 t_cost,
                                  JnaUint32 m_cost,
                                  JnaUint32 parallelism,
                                  byte[] pwd,
                                  Size_t pwdlen,
                                  byte[] salt,
                                  Size_t saltlen,
                                  Size_t hashlen,
                                  byte[] encoded,
                                  Size_t encodedlen)
        Hashes a password with Argon2id, producing an encoded hash.
        Parameters:
        t_cost - Number of iterations
        m_cost - Sets memory usage to m_cost kibibytes
        parallelism - Number of threads and compute lanes
        pwd - Pointer to password
        pwdlen - Password size in bytes
        salt - Pointer to salt
        saltlen - Salt size in bytes
        hashlen - Desired length of the hash in bytes
        encoded - Buffer where to write the encoded hash
        encodedlen - Size of the buffer (thus max size of the encoded hash)
        Returns:
        ARGON2_OK if successful
      • argon2d_hash_encoded

        int argon2d_hash_encoded​(JnaUint32 t_cost,
                                 JnaUint32 m_cost,
                                 JnaUint32 parallelism,
                                 byte[] pwd,
                                 Size_t pwdlen,
                                 byte[] salt,
                                 Size_t saltlen,
                                 Size_t hashlen,
                                 byte[] encoded,
                                 Size_t encodedlen)
        Hashes a password with Argon2d, producing an encoded hash.
        Parameters:
        t_cost - Number of iterations
        m_cost - Sets memory usage to m_cost kibibytes
        parallelism - Number of threads and compute lanes
        pwd - Pointer to password
        pwdlen - Password size in bytes
        salt - Pointer to salt
        saltlen - Salt size in bytes
        hashlen - Desired length of the hash in bytes
        encoded - Buffer where to write the encoded hash
        encodedlen - Size of the buffer (thus max size of the encoded hash)
        Returns:
        ARGON2_OK if successful
      • argon2i_hash_raw

        int argon2i_hash_raw​(JnaUint32 t_cost,
                             JnaUint32 m_cost,
                             JnaUint32 parallelism,
                             byte[] pwd,
                             Size_t pwdlen,
                             byte[] salt,
                             Size_t saltlen,
                             byte[] hash,
                             Size_t hashlen)
        Hashes a password with Argon2i, producing an encoded hash.
        Parameters:
        t_cost - Number of iterations
        m_cost - Sets memory usage to m_cost kibibytes
        parallelism - Number of threads and compute lanes
        pwd - Pointer to password
        pwdlen - Password size in bytes
        salt - Pointer to salt
        saltlen - Salt size in bytes
        hash - Buffer where to write the raw hash
        hashlen - Desired length of the hash in bytes
        Returns:
        ARGON2_OK if successful
      • argon2id_hash_raw

        int argon2id_hash_raw​(JnaUint32 t_cost,
                              JnaUint32 m_cost,
                              JnaUint32 parallelism,
                              byte[] pwd,
                              Size_t pwdlen,
                              byte[] salt,
                              Size_t saltlen,
                              byte[] hash,
                              Size_t hashlen)
        Hashes a password with Argon2id, producing an encoded hash.
        Parameters:
        t_cost - Number of iterations
        m_cost - Sets memory usage to m_cost kibibytes
        parallelism - Number of threads and compute lanes
        pwd - Pointer to password
        pwdlen - Password size in bytes
        salt - Pointer to salt
        saltlen - Salt size in bytes
        hash - Buffer where to write the raw hash
        hashlen - Desired length of the hash in bytes
        Returns:
        ARGON2_OK if successful
      • argon2d_hash_raw

        int argon2d_hash_raw​(JnaUint32 t_cost,
                             JnaUint32 m_cost,
                             JnaUint32 parallelism,
                             byte[] pwd,
                             Size_t pwdlen,
                             byte[] salt,
                             Size_t saltlen,
                             byte[] hash,
                             Size_t hashlen)
        Hashes a password with Argon2d, producing an encoded hash.
        Parameters:
        t_cost - Number of iterations
        m_cost - Sets memory usage to m_cost kibibytes
        parallelism - Number of threads and compute lanes
        pwd - Pointer to password
        pwdlen - Password size in bytes
        salt - Pointer to salt
        saltlen - Salt size in bytes
        hash - Buffer where to write the raw hash
        hashlen - Desired length of the hash in bytes
        Returns:
        ARGON2_OK if successful
      • argon2i_verify

        int argon2i_verify​(byte[] encoded,
                           byte[] pwd,
                           Size_t pwdlen)
        Verifies a password against an Argon2i encoded string.
        Parameters:
        encoded - String encoding parameters, salt, hash
        pwd - Pointer to password
        pwdlen - Password size in bytes
        Returns:
        ARGON2_OK if successful
      • argon2d_verify

        int argon2d_verify​(byte[] encoded,
                           byte[] pwd,
                           Size_t pwdlen)
        Verifies a password against an Argon2d encoded string.
        Parameters:
        encoded - String encoding parameters, salt, hash
        pwd - Pointer to password
        pwdlen - Password size in bytes
        Returns:
        ARGON2_OK if successful
      • argon2id_verify

        int argon2id_verify​(byte[] encoded,
                            byte[] pwd,
                            Size_t pwdlen)
        Verifies a password against an Argon2id encoded string.
        Parameters:
        encoded - String encoding parameters, salt, hash
        pwd - Pointer to password
        pwdlen - Password size in bytes
        Returns:
        ARGON2_OK if successful
      • argon2_encodedlen

        Size_t argon2_encodedlen​(JnaUint32 t_cost,
                                 JnaUint32 m_cost,
                                 JnaUint32 parallelism,
                                 JnaUint32 saltlen,
                                 JnaUint32 hashlen,
                                 Argon2_type type)
        Returns the encoded hash length for the given input parameters.
        Parameters:
        t_cost - Number of iterations.
        m_cost - Memory usage in kibibytes.
        parallelism - Number of threads; used to compute lanes.
        saltlen - Salt size in bytes.
        hashlen - Hash size in bytes.
        type - The argon2 type.
        Returns:
        The encoded hash length in bytes.
      • argon2_error_message

        java.lang.String argon2_error_message​(int error_code)
        Get the associated error message for given error code.
        Parameters:
        error_code - Numeric error code.
        Returns:
        The error message associated with the given error code.