yescrypt
Read and create yescrypt password records or derive key bytes in classic, WORM or read-write mode.
from oxcrypto.password.yescrypt import YESCRYPT
algorithm = YESCRYPT.YESCRYPT
encoded = algorithm.hash(b"example password")
assert algorithm.verify(b"example password", encoded)Password records use the Unix $y$ format. The raw KDF accepts salt, n (cost), r (block size), p (parallelization), and length (output bytes).
hash takes keyword-only n, r and p (defaults 4096, 32, 1, the
reference implementation's defaults). Both hash and derive take a mode:
mode | Meaning |
|---|---|
"rw" (default) | yescrypt's native read-write mode, recommended by the yescrypt documentation |
"worm" | write-once/read-many, a conservative enhancement of scrypt |
"classic" | classic scrypt; derive matches scrypt with log_n = log2(n) |
The mode is stored in the $y$ record, so verify needs no options.
encoded = algorithm.hash(b"example password", n=8192, r=32, p=1, mode="worm")
assert algorithm.verify(b"example password", encoded)yescrypt is a Password Hashing Competition special-recognition scheme without
RFC or NIST status; it is the default password hash in several Linux
distributions through libxcrypt. The implementation is the RustCrypto
yescrypt crate 0.1.0, an early stable release with no published audit.
Tests use the Openwall TESTS-OK vectors through RustCrypto/yescrypt.