[][src]Crate argon2

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).

OwnedContext

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.

ErrorCode

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.