yescrypt-PHC
An scrypt-derived memory-hard password hash, now the default in many Linux distributions
Source found and wired, correctness not fully proven. Root API only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.
About yescrypt-PHC
yescrypt-PHC is one of 2 yescrypt variants in the NextSSL registry, a password hashing function. It uses a 16–1,024-byte output and a 0–64-byte salt. It takes the parameters m_cost (default 4), out_len (default 32) and t_cost (default 0). Its registry entry cites Password Hashing Competition submission (2014-2015), PHC API PHS(). NextSSL lists it in the unverified tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).
Overview
yescrypt is a password hashing scheme by Alexander Peslyak (Solar Designer) that extends scrypt. It received special recognition in the Password Hashing Competition and has become the default password hash in /etc/shadow on several major Linux distributions.
yescrypt keeps scrypt's overall structure and remains scrypt-compatible with certain flags, but replaces the BlockMix core with pwxform, a function that performs small random-access lookups into S-boxes held in fast memory. This makes attacks on GPUs and other parallel hardware more expensive because they must replicate both large memory and fast small lookups. Optional features include pre-hashing with a large ROM and hash upgrades without the original password.
NextSSL implements yescrypt with the YESCRYPT_DEFAULTS flags, the configuration used by libxcrypt in modular-crypt $y$ hashes. Hashes in this format begin with '$y$' and include encoded parameters and salt, so they can be stored directly in /etc/shadow and verified by any compatible libxcrypt build. Debian, Fedora and Ubuntu moved to yescrypt as the default in recent releases.
History
2013–2015Password Hashing Competition announced
Password Hashing Competitionyescrypt published by Alexander Peslyak (Solar Designer)
24 candidates submitted; nine finalists named in December
Password Hashing CompetitionReceived special recognition in the Password Hashing Competition
Security notes
No weaknesses in yescrypt are known. Like scrypt, it uses data-dependent memory access, which can leak through cache timing on shared hardware. Its specification is a single implementation rather than an RFC.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| out | 16 – 1,024 | Output |
| salt | 0 – 64 | Salt |
Parameters
| Name | Type | Range | Default | Required |
|---|---|---|---|---|
| m_cost | u32 | 0 – 12 | 4 | no |
| out_len | u32 | 16 – 1024 | 32 | no |
| t_cost | u32 | 0 – 4 | 0 | no |
Parameters are passed as a string, for example nextssl_mac("hmac", "hash=sha512", …). Omitted parameters take their declared default.
Use it
from nextssl_demo import NextSSL
root = NextSSL(root=True) # tier 'unverified' is reachable from the root API only
phc = root.call("pwhash", "yescrypt-phc", None, b"correct horse")[0] # PHC string, fresh salt
ok = root.check("pwhash_verify", "yescrypt-phc", None, b"correct horse", phc)
nextssl_root_pwhash("yescrypt-phc", NULL, password, out);
nextssl_root_pwhash_verify("yescrypt-phc", NULL, password, phc);
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let alg = reg::new_pwhash_in(reg::all(), Policy::Any, "yescrypt-phc", &Params::new())?;
let phc = alg.hash(b"correct horse")?; // PHC string
let ok = alg.verify(b"correct horse", &phc)?;
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
Other yescrypt variants
1Similar names
Looking for something else?More password hashing
All 30Frequently asked questions
What is yescrypt-PHC?
yescrypt-PHC is a password hash in the yescrypt family. yescrypt is a password hashing scheme by Alexander Peslyak (Solar Designer) that extends scrypt.
What are the yescrypt-PHC sizes?
In NextSSL, yescrypt-PHC uses: output 16 to 1,024 bytes.
Who designed yescrypt-PHC and when?
yescrypt-PHC belongs to the yescrypt family, first published in 2014 by Alexander Peslyak (Solar Designer). Its origin: Password Hashing Competition finalist (special recognition).
Which standards define yescrypt-PHC?
yescrypt-PHC is referenced by Password Hashing Competition submission (2014-2015), PHC API PHS().
Is yescrypt-PHC safe to use?
yescrypt-PHC is in the unverified tier. Source found and wired, correctness not fully proven. Root API only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).
What other yescrypt variants are there?
NextSSL also registers yescrypt in the yescrypt family.