Fortuna prng

Fortuna Home GUI Monitor Design SeedFile Entropy Sources Source Code Changes

Fortuna is a cryptographically secure pseudo random number generator (PRNG) developed by Bruce Schneier and Niels Ferguson.  It is described in their book 'Practical Cryptography'.

I have developed a C++ implementation of Fortuna.  The design and the source code are available here, free for commercial or non commercial use.

The main goals of my implementation of Fortuna are the following:

bullet

Designed for use on web servers running Windows/XP  or Windows/2000

bullet

Difficult to attack

bullet

Follow the design of Ferguson and Schneier as closely as possible

bullet

Use information from Windows as data sources for the 'entropy' pools

My implementation differs from the original design in the following ways:

bullet

The seed file in the original design appears to only save the state of the generator (Section 10.6.1, page 178).  My seed file contains the state of each of the entropy pools.  The seed file is encrypted using password based encryption with a user supplied password.

Design Highlights

For more detailed information on the design of Fortuna, go here.

bullet

Highly multithreaded.  Each of the 32 entropy pools runs on it's own thread and each of the source pools runs on it's own thread.

bullet

There are 32 source threads which generate random data using the high performance counter timing the WaitForSingleObject function.    I've done a little study to investigate using the high performance counter and found that a number of the bits in the counter difference pass the Diehard randomness tests.

bullet

The high performance timer and changes in the process monitoring (page faults, I/O counts etc) provide most of the entropy

bullet

The Windows registry is used as a large data repository to populate the entropy pools with a data source with no entropy.  There are four threads which walk the registry, extracting data and adding it to the pools.  While this is certainly not random data, it makes an attackers job more difficult due to the size of the registry and the way that the data is distributed among the pools.

Entropy Sources

For more detailed information on entropy sources, go here.

Seed File

For more detailed information on the seed file, go here.

Credits

I used the SHA-1 and AES implementation from Dr. Brian Gladman.

I used the C++ Multithreading library from the book "Win32 Multithreaded Programming" by Cohen and Woodring.  This is an excellent book and if you are new to multithreading I highly recommend it.

The MFC monitor app uses the compression library from www.zlib.net.

Citadel Software Home Contact