HMAC-DRBG-SHA-256
NIST SP 800-90A deterministic random bit generator built on HMAC
About HMAC-DRBG-SHA-256
HMAC-DRBG-SHA-256 is a deterministic random bit generator from the HMAC_DRBG family. It uses a 32–1,024-byte seed. Its registry entry cites NIST SP 800-90A Rev. 1 section 10.1.2. It is also known as hmac_drbg-sha256 and hmac-drbg. NextSSL lists it in the standard tier and exposes it through the safe API.
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
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| seed | 32 – 1,024 | Seed |
Use it
from nextssl_demo import NextSSL
ns = NextSSL() # safe API: safe and standard tiers
h = ns.new_handle("drbg_new", "hmac-drbg-sha256", None, entropy, nonce, b"app")
out = ns.call("drbg_generate", U64(h), b"", 32)[0]
nextssl_drbg_new("hmac-drbg-sha256", NULL, entropy, nonce, pers, &handle);
nextssl_drbg_generate(handle, add, 32, out);
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let alg = reg::new_drbg_in(reg::all(), Policy::Safe, "hmac-drbg-sha256", &Params::new())?;
// instantiate / generate / reseed
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
Similar names
Looking for something else?Frequently asked questions
What is HMAC-DRBG-SHA-256?
HMAC-DRBG-SHA-256 is a DRBG in the HMAC_DRBG family. 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 also known as hmac_drbg-sha256, hmac-drbg.
Who designed HMAC-DRBG-SHA-256 and when?
HMAC-DRBG-SHA-256 belongs to the HMAC_DRBG family, first published in 2006 by John Kelsey, Elaine Barker (NIST). Its origin: NIST SP 800-90A Rev. 1, section 10.1.2.
Which standards define HMAC-DRBG-SHA-256?
HMAC-DRBG-SHA-256 is referenced by NIST SP 800-90A Rev. 1 section 10.1.2.
Is HMAC-DRBG-SHA-256 safe to use?
HMAC-DRBG-SHA-256 is in the standard tier. Standardised and sound. Reachable from the safe API. It can be called from the safe API.
Related families
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