HMAC_DRBG
NIST SP 800-90A deterministic random bit generator built on HMAC
Overview
HMAC_DRBG is a deterministic random bit generator that expands seed entropy into a long stream of cryptographically secure pseudorandom bits using HMAC. It is one of the three DRBG mechanisms approved in NIST SP 800-90A and is valued for its simple design and conservative security argument.
The generator keeps two secret values, a key K and a chaining value V. Its update function mixes new input into K and V with a few HMAC calls. To generate output, it repeatedly sets V = HMAC(K, V) and emits V, then runs update again so that compromise of the state after a request does not reveal earlier outputs (backtracking resistance). Reseeding with fresh entropy after a set number of requests provides prediction resistance against an attacker who previously learned the state.
HMAC_DRBG is also the deterministic nonce generator inside RFC 6979 for ECDSA. SP 800-90A Rev. 1 removed the Dual_EC_DRBG mechanism after concerns about a backdoor, leaving HMAC_DRBG, Hash_DRBG and CTR_DRBG. The variant present is hmac-drbg-sha256. Compared with CTR_DRBG it is slower but simpler to analyse, with fewer subtle requirements around derivation functions. Each Generate call may return at most 2^19 bits, and SP 800-90A requires reseeding after at most 2^48 requests.
History
2006–2015HMAC_DRBG specified in NIST SP 800-90
Retained in SP 800-90A Rev. 1 after Dual_EC_DRBG was removed
Specified in NIST SP 800-90A Rev. 1 section 10.1.2
How it works
- Instantiate: set K = 0x00..., V = 0x01..., then update with entropy, nonce and personalisation string.
- Update: K = HMAC(K, V || 0x00 || data), V = HMAC(K, V), and repeat with 0x01 if data is present.
- Generate: iterate V = HMAC(K, V) to produce output, then update to roll the state forward.
- Reseed: mix in fresh entropy when the reseed counter limit is reached or on demand.
Security notes
Security depends entirely on the quality of the seed entropy; seed from the operating system RNG. The state must be protected and never duplicated (for example by forking or VM snapshots) without reseeding, or outputs will repeat.
Typical uses
Variants in NextSSL
1| Algorithm | Tier | Sizes (bytes) | Standards | API |
|---|---|---|---|---|
| HMAC-DRBG-SHA-256 hmac-drbg-sha256 |
standard | seed 32–1024 | NIST SP 800-90A Rev. 1 section 10.1.2 | safe |
Frequently asked questions
Which HMAC_DRBG variants does NextSSL include?
NextSSL registers 1 HMAC_DRBG variant: hmac-drbg-sha256.
Families with similar names
Related
The NIST Merkle–Damgård hash family behind most of today's TLS, signatures and software
HKDFHMAC-based extract-and-expand key derivation function (RFC 5869)
Operating system RNGThe kernel's cryptographically secure random number generator, the right default
ECDSAElliptic Curve Digital Signature Algorithm on NIST curves and secp256k1