A pseudo-random number is a value or sequence of values that appears statistically random but is deterministically generated from a known starting point (seed) using an algorithm, making the sequence reproducible and repeatable rather than truly random.
Related Concepts
No related concepts available
Comprehensive Explanation
pseudo-random-number
Technical Definition
A pseudo-random number is a value or element that exhibits statistical properties of randomness but is generated through a deterministic algorithmic process from a known initial state called a seed. The fundamental characteristic distinguishing pseudo-random numbers from true random numbers is their reproducibility: given the same seed and algorithm, the exact same sequence will be generated every time.
In the KERI/ACDC ecosystem, pseudo-random numbers serve as foundational cryptographic primitives for generating:
The term "pseudo" explicitly indicates that while these numbers pass statistical randomness tests, they are not entirely random due to their deterministic and repeatable nature. This property is actually advantageous in cryptographic systems where reproducibility and verifiability are essential.
Formal Classification
Pseudo-random numbers fall into two security categories:
Basic PRNG (Pseudorandom Number Generator): Produces statistically random sequences but may be distinguishable from true randomness by intelligent attackers
CSPRNG (Cryptographically Secure Pseudorandom Number Generator): Produces sequences indistinguishable from true randomness even when the algorithm is known, provided the internal state remains secret
Implementation Notes
Implementation Notes
Critical Security Requirements
Always use CSPRNG sources for any security-critical pseudo-random number generation in KERI applications
Minimum 128 bits of entropy for all seed generation, as mandated by GLEIF governance frameworks
Never reuse seeds across different AIDs or key pairs
Protect seed material with encryption, HSMs, or TEEs appropriate to the security level required
Language-Specific Guidance
Python
import secrets
# Correct: Use secrets module for cryptographic randomness
seed = secrets.token_bytes(32) # 256 bits
# WRONG: Never use random module for cryptography
import random
seed = random.randbytes(32) # NOT cryptographically secure
JavaScript/Node.js
const crypto = require('crypto');
// Correct: Use crypto.randomBytes
const seed = crypto.randomBytes(32); // 256 bits
// WRONG: Never use Math.random() for cryptography
const seed = Math.random(); // NOT cryptographically secure
Testing and Validation
Implement entropy quality checks before key generation
Use NIST SP 800-22 statistical test suite to validate randomness
Monitor for entropy pool depletion in high-throughput scenarios
Test for bias and correlation in generated sequences
Performance Optimization
Batch generate random values when possible to reduce system call overhead
Use hardware acceleration (RDRAND, RDSEED instructions) when available
Avoid blocking entropy sources in production systems
Cache non-security-critical random values appropriately
Common Implementation Errors
Using weak PRNGs: Avoid language default random functions for cryptography
Insufficient entropy: Always use at least 128 bits, preferably 256 bits
Predictable seeding: Never seed with timestamps, PIDs, or other predictable values
Seed exposure: Never log, transmit, or store seeds in plaintext
Reusing nonces: Generate fresh pseudo-random values for each operation requiring uniqueness
For KERI applications requiring cryptographic strength, only CSPRNG outputs are acceptable, as they provide the security guarantees necessary for key management and identifier derivation.
Cryptographic Properties
Generation Algorithms
Pseudo-random number generation in KERI contexts relies on cryptographically secure algorithms that transform seed entropy into unpredictable output sequences. The GLEIF Identifier Governance Framework mandates that all AID generation must use either:
Cryptographically-secure pseudo-random number generators (CSPRNG)
True random number generators (hardware-based entropy sources)
Both must provide at least 128 bits of cryptographic strength, which represents the minimum entropy required to resist practical brute-force attacks. This 128-bit threshold is derived from information-theoretic security principles, where the number of possible keys (2^128) exceeds the computational capacity of any conceivable attacker, including quantum computers using Grover's algorithm (which would still require 2^64 operations).
Security Properties
For a pseudo-random number generator to be considered cryptographically secure, it must satisfy:
Unpredictability: Given any sequence of output values, an attacker cannot predict the next value with probability significantly better than random guessing
Indistinguishability: The output sequence is computationally indistinguishable from a truly random sequence
Forward Security: Compromise of the current internal state does not reveal previous outputs
Backward Security: Knowledge of previous outputs does not enable prediction of future outputs without knowing the internal state
These properties ensure that pseudo-random numbers used in KERIkey generation cannot be predicted or reproduced by attackers, even if they know the algorithm being used.
24 words = 264 bits of entropy (256 bits + 8-bit checksum)
Raw Binary/Hexadecimal: Direct representation of the entropy bytes
Typically 128, 192, or 256 bits
Encoded in hexadecimal for human readability
Used internally for cryptographic operations
CESR Encoding
When pseudo-random values are used in CESR (Composable Event Streaming Representation) streams, they are encoded with appropriate derivation codes that indicate:
The cryptographic algorithm used
The length of the value
The encoding format (text or binary domain)
For example, a UUID (high-entropy pseudo-random string) in an ACDC uses the u field with CESR-qualified encoding to ensure proper parsing and verification.
Salty Nonce Usage
In ACDC privacy mechanisms, pseudo-random numbers serve as salty nonces (the u field) to prevent rainbow table attacks. These are:
The XORA (Exclusive Or Accumulator) specification further details how pseudo-random values can be combined using XOR operations to create information-theoretically secure commitments with perfect security properties.
Usage in KERI/ACDC
Key Pair Generation
The primary use of pseudo-random numbers in KERI is key pair derivation:
Seed Generation: A CSPRNG produces a high-entropy seed
Private Key Derivation: The seed is processed through a one-way function to generate the private key
Public Key Derivation: The private key is processed to generate the corresponding public key
Seed (pseudo-random) → Private Key → Public Key → AID
Inception Event Creation
When creating an inception event for a new AID, pseudo-random numbers are used to:
Generate the current key pair for signing authority
Generate the next (pre-rotated) key pair for rotation authority
Create cryptographic digests of the next keys for pre-rotation commitment
The GLEIF Identifier Governance Framework mandates that both key sets must be generated from pseudo-random sources with at least 128 bits of cryptographic strength.
ACDC Privacy Protection
In ACDC credentials, pseudo-random numbers enable graduated disclosure mechanisms:
Private ACDCs include a u field containing a high-entropy pseudo-random UUID
This UUID acts as a salty nonce that blinds the SAID computation
Without knowledge of the UUID, attackers cannot perform rainbow table attacks to discover the ACDC contents
The UUID must be ≥128 bits to provide adequate protection
Witness and Watcher Infrastructure
Pseudo-random numbers are used in witness and watcher infrastructure for:
Generating ephemeral identifiers for one-time-use scenarios
Creating nonces for challenge-response protocols
Producing session identifiers for secure communication channels
No single party can predict or control the collective randomness
This comprehensive treatment of pseudo-random numbers demonstrates their foundational role in KERI/ACDC cryptographic infrastructure, from basic identifier generation to sophisticated privacy-preserving credential systems.
GLEIF vLEI Specific Requirements
Root AID generation: Must use hardware RNG or highest-quality CSPRNG
QVI credentials: Each ACDC must have unique pseudo-random UUID (≥128 bits)
Multi-sig coordination: Each signer must use independent entropy sources
Witness pools: Minimum 5 witnesses with independent pseudo-random identifier generation