Expand description
Thin wrapper for the Argon2 C library.
All public argon2 functions are mapped to functions with the argon2
prefix
and any leftover underscores after the prefix removed.
e.g. argon2_ctx
-> ctx
and argon2i_ctx
-> i_ctx
Structs§
- Structure to hold Argon2 inputs.
- Flags which control fields are securely wiped (zeroed).
- Structure to hold Argon2 inputs. Unlike
Context
, this version owns all of the input values.
Enums§
- Error type returned by all Rust wrappers of Argon2 functions.
- Error code returned by failed Argon2 C functions.
- Argon2 primitive type.
- Version of the algorithm.
Functions§
- Converts a slice of bytes to a CStr. Unlike CStr::from_bytes_with_nul this will stop at the first null byte instead of returning an error for interior null bytes. This will return an error if there are no null bytes at all.
- Converts a slice of bytes to a CStr much like
c_str
except this will allocate a C string for you instead with a terminating null byte if one cannot be found inside of the given byte string. - Function that performs memory-hard hashing with certain degree of parallelism.
- Argon2d: Version of Argon2 that picks memory blocks depending on the password and salt. Only for side-channel-free environment!!
- Hashes a password with Argon2d, producing an encoded (string) hash.
- Hashes a password with Argon2d, producing a raw hash.
- Verifies a password against an encoded string using Argon2d.
- Verify if a given password is correct for Argon2d hashing.
- Returns the encoded hash length for the given input parameters.
- Get the associated error message for a given error code.
- Generic Argon2 hash function.
- Argon2i: Version of Argon2 that picks memory blocks independent on the password and salt. Good for side-channels, but worse with respect to tradeoff attacks if only one pass is used.
- Hashes a password with Argon2i, producing an encoded (string) hash.
- Hashes a password with Argon2i, producing a raw hash.
- Verifies a password against an encoded string using Argon2i.
- Verify if a given password is correct for Argon2i hashing.
- Argon2id: Version of Argon2 where the first half-pass over memory is password-independent, the rest are password-dependent (on the password and salt). OK against side channels (they reduce to 1/2-pass Argon2i), and better with respect to tradeoff attacks (similar to Argon2d).
- Hashes a password with Argon2id, producing an encoded (string) hash.
- Hashes a password with Argon2id, producing a raw hash.
- Verifies a password against an encoded string using Argon2id.
- Verify if a given password is correct for Argon2id hashing.
- Function that gives the string representation of an argon2 Variant. If the
uppercase
parameter is true, the name of the variant is returned with the first letter uppercased. - Verifies a password against an encoded string.
- Verify if a given password is correct for a given variant of Argon2 hashing.