Package de.mkammerer.argon2.jna
Interface Argon2Library
-
- All Superinterfaces:
com.sun.jna.Library
public interface Argon2Library extends com.sun.jna.LibraryJNA bindings for Argon2.
-
-
Field Summary
Fields Modifier and Type Field Description static intARGON2_OKReturn code if everything is okay.static Argon2LibraryINSTANCESingleton instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Size_targon2_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.java.lang.Stringargon2_error_message(int error_code)Get the associated error message for given error code.intargon2_hash(JnaUint32 t_cost, JnaUint32 m_cost, JnaUint32 parallelism, byte[] pwd, Size_t pwdlen, byte[] salt, Size_t saltlen, byte[] hash, Size_t hashlen, byte[] encoded, Size_t encodedlen, Argon2_type type, JnaUint32 version)intargon2d_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.intargon2d_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.intargon2d_verify(byte[] encoded, byte[] pwd, Size_t pwdlen)Verifies a password against an Argon2d encoded string.intargon2i_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.intargon2i_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.intargon2i_verify(byte[] encoded, byte[] pwd, Size_t pwdlen)Verifies a password against an Argon2i encoded string.intargon2id_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.intargon2id_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.intargon2id_verify(byte[] encoded, byte[] pwd, Size_t pwdlen)Verifies a password against an Argon2id encoded string.
-
-
-
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 iterationsm_cost- Sets memory usage to m_cost kibibytesparallelism- Number of threads and compute lanespwd- Pointer to passwordpwdlen- Password size in bytessalt- Pointer to saltsaltlen- Salt size in byteshashlen- Desired length of the hash in bytesencoded- Buffer where to write the encoded hashencodedlen- Size of the buffer (thus max size of the encoded hash)- Returns:
ARGON2_OKif 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 iterationsm_cost- Sets memory usage to m_cost kibibytesparallelism- Number of threads and compute lanespwd- Pointer to passwordpwdlen- Password size in bytessalt- Pointer to saltsaltlen- Salt size in byteshashlen- Desired length of the hash in bytesencoded- Buffer where to write the encoded hashencodedlen- Size of the buffer (thus max size of the encoded hash)- Returns:
ARGON2_OKif 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 iterationsm_cost- Sets memory usage to m_cost kibibytesparallelism- Number of threads and compute lanespwd- Pointer to passwordpwdlen- Password size in bytessalt- Pointer to saltsaltlen- Salt size in byteshashlen- Desired length of the hash in bytesencoded- Buffer where to write the encoded hashencodedlen- Size of the buffer (thus max size of the encoded hash)- Returns:
ARGON2_OKif 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 iterationsm_cost- Sets memory usage to m_cost kibibytesparallelism- Number of threads and compute lanespwd- Pointer to passwordpwdlen- Password size in bytessalt- Pointer to saltsaltlen- Salt size in byteshash- Buffer where to write the raw hashhashlen- Desired length of the hash in bytes- Returns:
ARGON2_OKif 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 iterationsm_cost- Sets memory usage to m_cost kibibytesparallelism- Number of threads and compute lanespwd- Pointer to passwordpwdlen- Password size in bytessalt- Pointer to saltsaltlen- Salt size in byteshash- Buffer where to write the raw hashhashlen- Desired length of the hash in bytes- Returns:
ARGON2_OKif 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 iterationsm_cost- Sets memory usage to m_cost kibibytesparallelism- Number of threads and compute lanespwd- Pointer to passwordpwdlen- Password size in bytessalt- Pointer to saltsaltlen- Salt size in byteshash- Buffer where to write the raw hashhashlen- Desired length of the hash in bytes- Returns:
ARGON2_OKif 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, hashpwd- Pointer to passwordpwdlen- Password size in bytes- Returns:
- ARGON2_OK if successful
-
argon2_hash
int argon2_hash(JnaUint32 t_cost, JnaUint32 m_cost, JnaUint32 parallelism, byte[] pwd, Size_t pwdlen, byte[] salt, Size_t saltlen, byte[] hash, Size_t hashlen, byte[] encoded, Size_t encodedlen, Argon2_type type, JnaUint32 version)
-
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, hashpwd- Pointer to passwordpwdlen- 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, hashpwd- Pointer to passwordpwdlen- 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.
-
-