Password hashing

PBKDF2-HMAC-SHA-512

The iterated-HMAC password-based key derivation function from PKCS #5 and NIST SP 800-132

standard Safe API Specified in a FIPS standard

About PBKDF2-HMAC-SHA-512

PBKDF2-HMAC-SHA-512 is one of 4 PBKDF2 variants in the NextSSL registry, a password hashing function. It uses a 16–1,024-byte output and a 4–64-byte salt. It takes the parameters iterations (default 210000) and out_len (default 64). Its registry entry cites RFC 8018 and NIST SP 800-132. NextSSL lists it in the standard tier and exposes it through the safe API.

Overview

PBKDF2 is a password-based key derivation function defined in PKCS #5 (now RFC 8018). It applies a pseudo-random function, usually HMAC, many times to slow down brute-force guessing, and is approved by NIST in SP 800-132 and widely required in FIPS environments.

For each output block i, PBKDF2 computes U1 = PRF(password, salt ‖ i), then U2 = PRF(password, U1), and so on for c iterations, XORing all Uj together to form the block. Blocks are concatenated to the requested key length. The iteration count c is the only cost parameter; memory use is negligible.

NextSSL includes a generic PBKDF2 and PBKDF2-HMAC-SHA1, PBKDF2-HMAC-SHA256 and PBKDF2-HMAC-SHA512 instances, matching test vectors from RFC 6070 and RFC 7914. PBKDF2 is used in WPA2 Wi-Fi keys, many disk-encryption formats, password managers and Django's default password hasher. Its simplicity has made it the most portable choice. Salts should be at least 16 bytes.

History

2000–2017
  1. PBKDF2 published in PKCS #5 v2.0 (RFC 2898)

  2. Recommended in NIST SP 800-132

  3. Specified in RFC 7914 section 11

  4. RFC 8018 updates PKCS #5

How it works

  1. Compute U1 = HMAC(password, salt ‖ block index)
  2. Iterate Uj = HMAC(password, Uj−1) c times
  3. XOR all Uj into the output block
  4. Concatenate blocks to the requested length

Security notes

PBKDF2 is not broken, but because it needs almost no memory it is far cheaper to attack with GPUs and ASICs than memory-hard functions. Iteration counts must be high: OWASP currently suggests hundreds of thousands of iterations for HMAC-SHA256. Requesting more output than the PRF's length multiplies the defender's cost but not the attacker's.

Typical uses

Password storage in FIPS-constrained environmentsWPA2 and disk-encryption key derivationLegacy format compatibility

Sizes

FieldBytesMeaning
out16 – 1,024Output
salt4 – 64Salt

Parameters

NameTypeRangeDefaultRequired
iterations u32 1 – 16777216 210000 no
out_len u32 16 – 1024 64 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

ns = NextSSL()              # safe API: safe and standard tiers
phc = ns.call("pwhash", "pbkdf2-hmac-sha512", None, b"correct horse")[0]   # PHC string, fresh salt
ok  = ns.check("pwhash_verify", "pbkdf2-hmac-sha512", None, b"correct horse", phc)

Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.

Frequently asked questions

What is PBKDF2-HMAC-SHA-512?

PBKDF2-HMAC-SHA-512 is a password hash in the PBKDF2 family. PBKDF2 is a password-based key derivation function defined in PKCS #5 (now RFC 8018).

What are the PBKDF2-HMAC-SHA-512 sizes?

In NextSSL, PBKDF2-HMAC-SHA-512 uses: output 16 to 1,024 bytes.

Who designed PBKDF2-HMAC-SHA-512 and when?

PBKDF2-HMAC-SHA-512 belongs to the PBKDF2 family, first published in 2000. Its origin: PKCS #5 v2.0; RFC 8018; NIST SP 800-132.

Which standards define PBKDF2-HMAC-SHA-512?

PBKDF2-HMAC-SHA-512 is referenced by RFC 8018, NIST SP 800-132. It is specified in a FIPS standard.

Is PBKDF2-HMAC-SHA-512 safe to use?

PBKDF2-HMAC-SHA-512 is in the standard tier. Standardised and sound. Reachable from the safe API. It can be called from the safe API.

What other PBKDF2 variants are there?

NextSSL also registers pbkdf2, pbkdf2-hmac-sha1, pbkdf2-hmac-sha256 in the PBKDF2 family.