GitHub - nickpts/Ventura: Fortuna PRNG with improvements suggested by Dodis et al, support for AES, TwoFish, Serpent, BlowFish and high entropy sources

2 min read Original article ↗

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 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 rng and reads seed
using var prng = RNGVenturaProviderFactory.Create(stream);

// get a random number from 1 to 
int randomNumber = prng.Next(1, 10); 
// new seed will be written to stream at end of using scope

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

No longer supported due to subscription limitations.

Performance

Time taken to generate 10 random numbers between 1 and 10 using MemoryStream, AES and full entropy reseed. !Alt_Text

Acknowledgements

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