Password hashing
Store and verify password hashes or derive key bytes.
Use hash to create a salted password record and verify to check a
password against it. Use derive for raw key bytes. The algorithm page
shows the methods and record format available for each selector.
Algorithms
- Argon2 provides Argon2d, Argon2i, and Argon2id.
- Balloon Create and verify Balloon or Balloon-M password records over SHA-2 or SHA-3.
- bcrypt Create and verify OpenBSD-compatible
$2a$,$2b$and$2y$bcrypt password records. - bcrypt-pbkdf Derive key bytes for formats such as OpenSSH encrypted private keys.
- Legacy crypt Verify insecure md5-crypt, DES crypt and BSDi crypt Unix password records.
- password-auth Verify Argon2, PBKDF2 and scrypt records without knowing the scheme, and detect records that need rehashing.
- PBKDF2 Derive keys or store password records with HMAC over SHA-1, SHA-2 or SHA-3.
- scrypt Create memory-hard password records or derive key bytes with scrypt.
- SHA-crypt Read and create Unix password records in the SHA-256 or SHA-512 crypt formats.
- yescrypt Read and create yescrypt password records or derive key bytes in classic, WORM or read-write mode.
Zeroization
oxcrypto can only wipe buffers that Rust owns. The bytes you pass as a password,
secret or salt, and the bytes or str it returns, are Python objects. They are
not wiped, and Python may copy them. This is not a guarantee that a password is
erased from process memory.
Rust-side status per crate, from reading each crate's source. The table describes what the code is written to do; oxcrypto has not verified it independently.
| Crate | Wiped | Not wiped |
|---|---|---|
argon2 0.6.0 | Initial hash, final block hash, memory matrix (oxcrypto allocates and wipes it for hash, verify and derive) | Memory matrix when password-auth verifies an Argon2 record |
balloon-hash 0.5.0 | Memory blocks | Stack temporaries |
bcrypt 0.19.3 | Password copy, Blowfish key schedule | Stack block and output arrays |
pbkdf2 0.13.0 | HMAC state | Final PRF block on the stack |
hmac 0.13.0 SimpleHmac (PBKDF2 over SHA-3) | Inner digest state | Outer pad key |
scrypt 0.12.0 | Nothing | B, V, T buffers |
yescrypt 0.1.0 | Nothing | V, B, XY buffers |
pw_hash 0.1.3 | Nothing | Password copies, MD5 and DES state |