December 6, 2017

RNG/DRBG/PRNG Cheat Sheet

  • RNG (Random Number Generator) produces random bits
    • non-deterministic
    • uses external analog source
  • DRBG (Deterministic Random Bit Generator) produces pseudorandom bits
    • deterministic
    • from a seed (taken from RNG)
  • PRNG (Pseudo-Random Number Generator) produces pseudorandom bits
    • non-deterministic
    • from a seeds from an RNG to maintain entropy pool
    • produces output bits using a DRBG
Analog Source + seed --> RNG --> 010..10 --> PRNG (DRBG is a component of PRNG) --> 0101011100..01 

Deterministic Random Bit Generator, DRBG
INPUT: short fixed-length seed (e.g. 256 bit)
OUTPUT: arbitrarily long

Bad, do not use Good, do use
rand(3) /dev/urandom
random(3) Linux getrandom()
PHP rand() Java SecureRandom
your own algorithm Node.js crypto.randomBytes
&nbrp; WINAPI BCryptGenRandom
&nbrp; openssl rand

No comments: