Password hash family

Unix crypt formats

Classic modular-crypt password hashes: BSDi DES, md5crypt, sha256crypt and sha512crypt

legacy 4 variants Unix crypt(3) family; Drepper SHA-crypt specification

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–2007
  1. DES-based crypt(3) ships in Version 7 Unix (Robert Morris, Ken Thompson)

  2. MD5-crypt written by Poul-Henning Kamp for FreeBSD

  3. 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

Verifying existing /etc/shadow entriesMigrating legacy password databases

Variants in NextSSL

4
AlgorithmTierSizes (bytes)StandardsAPI
Sha256crypt
sha256crypt
legacy out 32 · salt 1–16 Drepper SHA-crypt root
Sha512crypt
sha512crypt
legacy out 64 · salt 1–16 Drepper SHA-crypt root
Bsdicrypt
bsdicrypt
broken out 8 · salt 4 BSDi extended DES crypt root
Md5crypt
md5crypt
broken out 16 · salt 0–8 FreeBSD md5crypt ($1$) root

Frequently asked questions

Which Unix crypt formats variants does NextSSL include?

NextSSL registers 4 Unix crypt formats variants: sha256crypt, sha512crypt, bsdicrypt, md5crypt.