Skip to content

Build a CSPRNG

Implement a cryptographic random number generator. Learn why Math.random() and rand() are insecure, how the OS gathers entropy, and implement HMAC-DRBG (NIST SP 800-90A) and Fortuna. The foundation underneath every TLS handshake, every AES IV, every session token.

intermediate8 lessons4 chapters8 graded exercisesPython

No sign-up needed for lesson 1 · certificate on completion · sign up to save progress

What you’ll have built

Chapter by chapter. Every step is a graded exercise.

  • What's Wrong with rand()
  • Entropy Sources
  • Cryptographic RNGs
  • Production
Starts in Python — solve in the language you choose in the editor, same tests either way.

Curriculum

4 chapters, 8 lessons. Each lesson is a short read, one graded exercise, and a quiz.

  1. 1Why rand() is PredictableRead · exercise · quiz
  2. 2LCG (Linear Congruential Generator)Read · exercise · quiz
Loading reference solution…