Module hash

Source

StructsΒ§

HashOpts
The options for hashing a password
PasswordHash
ScramSha256Hash πŸ”’
The SCRAM-SHA-256 hash

EnumsΒ§

HashError
VerifyError

ConstantsΒ§

DEFAULT_ITERATIONS πŸ”’
The default iteration count as suggested by https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html
DEFAULT_SALT_SIZE πŸ”’
The default salt size, which isn’t currently configurable.
SHA256_OUTPUT_LEN πŸ”’

FunctionsΒ§

hash_password
Hashes a password using PBKDF2 with SHA256 and a random salt.
hash_password_inner πŸ”’
hash_password_with_opts
Hashes a password using PBKDF2 with SHA256 and the given options.
scram256_hash
Hashes a password using PBKDF2 with SHA256, and returns it in the SCRAM-SHA-256 format. The format is SCRAM-SHA-256$:$<client_key>:<server_key>
scram256_hash_inner πŸ”’
scram256_parse_opts πŸ”’
Parses a SCRAM-SHA-256 hash and returns the options used to create it.
scram256_verify
Verifies a password against a SCRAM-SHA-256 hash.