This is an implementation of the Fortuna PRNG by Niels Ferguson and Bruce Schneier. The design is from their book 'Practical Cryptography'. I have tried to follow their design as closely as possible, but there are a few differences.
The main differences are:
| The seed file is encrypted with a user supplied password. | |
| The state of each of the 32 entropy pools is written to the seed file. | |
| I developed a fast linked list structure to hold the pool data in memory. |
Fortuna uses 32 entropy pools, to allow recovery from a compromise of the pool state. Pool i is only used once every 2^i reseeds. Because some pools will not be used very often an attacker will not be able to deduce the pool contents very easily.
| Generator - generates the actual pseudo random numbers | |
| Pool Manager and Pools - accumluates entropy and hashes state as required | |
| Source Manager and Sources - collects entropy and feeds entropy to the pools | |
|
Seed File - Encrypts the prng state and reads from and writes to disk
|
| QueryPerformanceCounter - there are 32 threads that collect entropy by using QueryPerformanceCounter on Sleep(1) | |
| There are 4 threads that walk the registry. This forces an attacker to capture the registry of the machine running Fortuna. | |
| There is 1 thread monitoring the process data for each process (virtual memory, page faults, I/O Read and Write bytes, etc) | |
| There is 1 thread which uses the Microsoft Crypto API as a random data source. This way an attacker has to break the Microsoft Crypto API as part of attacking this implementation of Fortuna. |
Adding new sources is very easy in this design. Each source is derived from the base class Source, see Source.cpp / .h for details.
![]()
![]()
1.3.5