Bsdicrypt
Classic modular-crypt password hashes: BSDi DES, md5crypt, sha256crypt and sha512crypt
Practical attacks exist. Present for compatibility and research only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.
About Bsdicrypt
Bsdicrypt is one of 4 Unix crypt formats variants in the NextSSL registry, a password hashing function. It uses an 8-byte (64-bit) output and a 4-byte salt. It takes the parameter rounds (default 7250). Its registry entry cites BSDi extended DES crypt. It is also known as bsdi-crypt and extended-des-crypt. NextSSL lists it in the broken tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).
Overview
These are password hashing schemes from the Unix crypt(3) tradition, stored in /etc/shadow and similar files with identifying prefixes. NextSSL includes them so that existing password databases can be verified and migrated.
BSDi extended DES crypt ('_' prefix) extends the original DES-based crypt with a 24-bit salt, a configurable iteration count and support for longer passwords. md5crypt ($1$), designed by Poul-Henning Kamp for FreeBSD, mixes the password, salt and MD5 in a fixed 1000-round loop. sha256crypt ($5$) and sha512crypt ($6$), specified by Ulrich Drepper in 2007, follow a similar structure with SHA-2 and a configurable rounds parameter, defaulting to 5000.
sha512crypt was the default on most Linux distributions until many moved to yescrypt. All four formats encode output using the crypt(3) base64 alphabet. Each format stores its salt and parameters in the hash string, so they can coexist in one file. Systems usually upgrade hashes to a newer format at the user's next successful login, which is the safe way to migrate away from these schemes.
History
1979–2007DES-based crypt(3) ships in Version 7 Unix (Robert Morris, Ken Thompson)
MD5-crypt written by Poul-Henning Kamp for FreeBSD
SHA-crypt ($5$, $6$) specified by Ulrich Drepper
Security notes
BSDi DES crypt and md5crypt are broken for modern use: they are fast to attack, and md5crypt's own author declared it insecure in 2012. sha256crypt and sha512crypt are acceptable only with high round counts and lack memory-hardness; prefer yescrypt or Argon2id.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| out | 8 | Output |
| salt | 4 | Salt |
Parameters
| Name | Type | Range | Default | Required |
|---|---|---|---|---|
| rounds | u64 | 1 – 1048575 | 7250 | 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 'broken' is reachable from the root API only
phc = root.call("pwhash", "bsdicrypt", None, b"correct horse")[0] # PHC string, fresh salt
ok = root.check("pwhash_verify", "bsdicrypt", None, b"correct horse", phc)
nextssl_root_pwhash("bsdicrypt", NULL, password, out);
nextssl_root_pwhash_verify("bsdicrypt", NULL, password, phc);
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let alg = reg::new_pwhash_in(reg::all(), Policy::Any, "bsdicrypt", &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 Unix crypt formats variants
3Similar names
Looking for something else?More password hashing
All 30Frequently asked questions
What is Bsdicrypt?
Bsdicrypt is a password hash in the Unix crypt formats family. These are password hashing schemes from the Unix crypt(3) tradition, stored in /etc/shadow and similar files with identifying prefixes. It is also known as bsdi-crypt, extended-des-crypt.
What are the Bsdicrypt sizes?
In NextSSL, Bsdicrypt uses: output 8 bytes.
Which standards define Bsdicrypt?
Bsdicrypt is referenced by BSDi extended DES crypt.
Is Bsdicrypt safe to use?
Bsdicrypt is in the broken tier. Practical attacks exist. Present for compatibility and research only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).
What other Unix crypt formats variants are there?
NextSSL also registers md5crypt, sha256crypt, sha512crypt in the Unix crypt formats family.
Related families
The 1977 US standard cipher, broken by exhaustive search, and its three-pass extension
MD2, MD4 and MD5Ron Rivest's message-digest hashes; all three are broken and kept for legacy use
SHA-2The NIST Merkle–Damgård hash family behind most of today's TLS, signatures and software
Argon2The Password Hashing Competition winner: memory-hard hashing standardised in RFC 9106
bcryptThe Blowfish-based adaptive password hash, a long-standing default in web frameworks
yescryptAn scrypt-derived memory-hard password hash, now the default in many Linux distributions