Skip to content
CoreSource checked

HMAC-DRBG

Generates deterministic random bits by updating HMAC-based internal state.

Quick Facts

Compact metadata for implementation and discovery.

Category
Cryptography
Difficulty
Intermediate
Family
Deterministic Random Bit Generators
Tier
Core
Status
Verified
Review
Source Checked
Sources
1
Formulas
0
Relationships
5
Code example
Ready
Visualization
Ready
Aliases
HMAC Deterministic Random Bit Generator

Overview

HMAC-DRBG maintains key and value state and refreshes that state with entropy, nonce, and optional personalization input. Each request produces pseudorandom bits through repeated HMAC evaluations.

Core Concepts

cryptographic random generationdeterministic random bit generatorsbit masksrandom samplingcryptography

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(V + E)

Average

O((V + E) log V)

Worst

O(V^2 + E)

Space

O(V + E)

When to Use

  • Use through a vetted implementation when a standards-based DRBG is required.
  • Use when entropy input, reseeding, and state lifetime can be managed explicitly.

When Not to Use

  • Avoid hand-rolled versions in production security code.
  • Avoid when entropy quality or state compromise behavior cannot be controlled.

What It Does

  • Initializes DRBG state from entropy and nonce input
  • Generates blocks through HMAC state updates
  • Reseeds state when required by the security policy

Use Cases

  • Standards-based deterministic random bit generation
  • Testable pseudorandom generation with explicit seeding
  • Systems that already depend on HMAC primitives

Inputs

  • Message, key, modulus, seed, or public parameters
  • Security parameter or nonce when required

Outputs

  • Cryptographic value such as signature, random bits, proof, or modular result

Pseudocode

  1. 1.Instantiate key and value state from entropy, nonce, and personalization input
  2. 2.For each generate request, update state with any additional input
  3. 3.Repeatedly compute value = HMAC(key, value) and append output bytes
  4. 4.Update state after generation
  5. 5.Reseed when required by the reseed policy

Canonical Example

Input
entropy input, nonce, and requested output length = 32 bytes
Output
32 bytes of deterministic random output
Explanation
The generator updates HMAC state from the seed material and emits output blocks until the request is satisfied.

Implementation Notes

  • Keep instantiate, reseed, generate, and update operations separate.
  • Zero sensitive state according to the host language and platform guidance.
  • Use official limits for request size, reseed interval, and security strength.

Common Pitfalls

  • Skipping nonce, personalization, or reseed rules weakens the intended security model.
  • Reusing state after compromise without reseeding can leak future outputs.
  • Treating generated bits as secure without checking instantiation errors is unsafe.

Interactive Mechanism Walkthrough

Graph Frontier & Edge Relaxation

Show deriving pseudorandom bits from HMAC state updates on a small cryptographic random generation example.

HMAC-DRBG mechanism walkthrough step 1 of 5suvwxt
Step 1 of 5: Instantiate key and value state from entropy, nonce, and personalization input
cryptography-mechanism

Notes

DRBG state management is as important as the block-generation step.

Sources (1)

What each reference supports for this entry.

NIST SP 800-90A Rev. 1

Documentation

NIST reference for HMAC-DRBG instantiation, reseeding, and deterministic random bit generation.

Open source

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

UsesHMAC

HMAC-DRBG uses HMAC as its state update and output primitive.

Alternative toCTR-DRBG

HMAC-DRBG and CTR-DRBG are standardized DRBG constructions with different core primitives.

Related Algorithms

Tags

CryptographyRandomnessGraph