Deterministic random bit generators

HMAC-DRBG-SHA-256

NIST SP 800-90A deterministic random bit generator built on HMAC

standard Safe API

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–2015
  1. HMAC_DRBG specified in NIST SP 800-90

  2. Retained in SP 800-90A Rev. 1 after Dual_EC_DRBG was removed

  3. Specified in NIST SP 800-90A Rev. 1 section 10.1.2

How it works

  1. Instantiate: set K = 0x00..., V = 0x01..., then update with entropy, nonce and personalisation string.
  2. Update: K = HMAC(K, V || 0x00 || data), V = HMAC(K, V), and repeat with 0x01 if data is present.
  3. Generate: iterate V = HMAC(K, V) to produce output, then update to roll the state forward.
  4. 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

Deterministic nonce generation for ECDSA (RFC 6979)FIPS-compliant random bit generationExpanding OS entropy for high-volume key generation

Sizes

FieldBytesMeaning
seed32 – 1,024Seed

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]

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

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.