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§
- Context
- Structure to hold Argon2 inputs.
- Flags
- Flags which control fields are securely wiped (zeroed).
- Owned
Context - Structure to hold Argon2 inputs. Unlike
Context
, this version owns all of the input values.
Enums§
- Error
- Error type returned by all Rust wrappers of Argon2 functions.
- Error
Code - Error code returned by failed Argon2 C functions.
- Variant
- Argon2 primitive type.
- Version
- Version of the algorithm.
Functions§
- c_str
- 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.
- c_
str_ cow - 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. - ctx
- Function that performs memory-hard hashing with certain degree of parallelism.
- d_ctx
- Argon2d: Version of Argon2 that picks memory blocks depending on the password and salt. Only for side-channel-free environment!!
- d_
hash_ encoded - Hashes a password with Argon2d, producing an encoded (string) hash.
- d_
hash_ raw - Hashes a password with Argon2d, producing a raw hash.
- d_
verify - Verifies a password against an encoded string using Argon2d.
- d_
verify_ ctx - Verify if a given password is correct for Argon2d hashing.
- encodedlen
- Returns the encoded hash length for the given input parameters.
- error_
message - Get the associated error message for a given error code.
- hash
- Generic Argon2 hash function.
- i_ctx
- 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.
- i_
hash_ encoded - Hashes a password with Argon2i, producing an encoded (string) hash.
- i_
hash_ raw - Hashes a password with Argon2i, producing a raw hash.
- i_
verify - Verifies a password against an encoded string using Argon2i.
- i_
verify_ ctx - Verify if a given password is correct for Argon2i hashing.
- id_ctx
- 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).
- id_
hash_ encoded - Hashes a password with Argon2id, producing an encoded (string) hash.
- id_
hash_ raw - Hashes a password with Argon2id, producing a raw hash.
- id_
verify - Verifies a password against an encoded string using Argon2id.
- id_
verify_ ctx - Verify if a given password is correct for Argon2id hashing.
- type2string
- 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. - verify
- Verifies a password against an encoded string.
- verify_
ctx - Verify if a given password is correct for a given variant of Argon2 hashing.