/Ventura

Fortuna PRNG with improvements suggested by Dodis et al, support for AES, TwoFish, Serpent, BlowFish and high entropy sources

Primary LanguageC#MIT LicenseMIT

Ventura

!Alt_Text

A .NET Standard library implementing the Fortuna PRNG as devised by Bruce Schneier and Niels Ferguson in 2003. Also implemented are reseeding improvements suggested by Dodis et al in "How to Eat Your Entropy and Have it Too".

Build Status Docker Cloud Build Status Nuget GitHub repo size GitHub GitHub last commit

Description

How does this differ from existing Fortuna implementations?

  1. Reseeding is pseudo-random rather than cyclical (Dodis et al).
  2. Reading an entropy pool empties multiple pools (Dodis et al).
  3. Support for TwoFish, Serpent and BlowFish in addition to AES (default).
  4. Remote entropy sources (weather, radioactive decay, atmospheric noise) included apart from local.

For more info on the above as well as performance, testing and limitations, please see the wiki.

Example

// seed stream
var stream = new FileStream("seed", FileMode.OpenOrCreate);

// instantiate and read seed 
using (var prng = RNGVenturaServiceProviderFactory.Create(stream))
{
    // get a random number from 0 to 10
    int randomNumber = prng.Next(0, 10); 
} // new seed will be written to stream.

How to run

Prints a random number from 1 to 10, reads/writes seed to seed.bin

dotnet Ventura.Cli.dll rn -s seed.bin -i 1 -x 10

Prints 100 random numbers from 1 to 10, reads/writes seed to seed.bin

dotnet Ventura.Cli.dll rns -s seed.bin -i 1 -x 10 -n 100

Docker

docker pull nickpatsaris/ventura.cli
docker run -ti 147dbbbb24da rn -s seed.bin -i 1 -x 10
docker run -ti 147dbbbb24da rns -s seed.bin -i 1 -x 10 -n 100

Acknowledgements

Bouncy Castle for ciphers. John Walker for ENT testing and HotBits radioactive decay entropy