Skip to content

Pure Python Ultra High Entropy Pseudo Random Number Generator

Notifications You must be signed in to change notification settings

wuftymerguftyguff/uheprng

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a python implementation of the Ultra High Entropy Pseudo Random Number Generator developed by
Steve Gibson of grc.com.  Steve was kind enough to release his javascript implementation as public domain
so I wish to do the same for my hacked together python version.

============================================================================
LICENSE AND COPYRIGHT:  THIS CODE IS HEREBY RELEASED INTO THE PUBLIC DOMAIN
Gibson Research Corporation releases and disclaims ALL RIGHTS AND TITLE IN
THIS CODE OR ANY DERIVATIVES. Anyone may be freely use it for any purpose.
============================================================================
This is GRC's cryptographically strong PRNG (pseudo-random number generator)
for JavaScript. It is driven by 1536 bits of entropy, stored in an array of
48, 32-bit JavaScript variables.  Since many applications of this generator,
including ours with the "Off The Grid" Latin Square generator, may require
the deteriministic re-generation of a sequence of PRNs, this PRNG's initial
entropic state can be read and written as a static whole, and incrementally
evolved by pouring new source entropy into the generator's internal state.
----------------------------------------------------------------------------
ENDLESS THANKS are due Johannes Baagoe for his careful development of highly
robust JavaScript implementations of JS PRNGs.  This work was based upon his
JavaScript "Alea" PRNG which is based upon the extremely robust Multiply-
With-Carry (MWC) PRNG invented by George Marsaglia. MWC Algorithm References:
http://www.GRC.com/otg/Marsaglia_PRNGs.pdf
http://www.GRC.com/otg/Marsaglia_MWC_Generators.pdf
----------------------------------------------------------------------------
The quality of this algorithm's pseudo-random numbers have been verified by
multiple independent researchers. It handily passes the fermilab.ch tests as
well as the "diehard" and "dieharder" test suites.  For individuals wishing
to further verify the quality of this algorithm's pseudo-random numbers, a
256-megabyte file of this algorithm's output may be downloaded from GRC.com,
and a Microsoft Windows scripting host (WSH) version of this algorithm may be
downloaded and run from the Windows command prompt to generate unique files
of any size:
The Fermilab "ENT" tests: http://fourmilab.ch/random/
The 256-megabyte sample PRN file at GRC: https://www.GRC.com/otg/uheprng.bin
The Windows scripting host version: https://www.GRC.com/otg/wsh-uheprng.js
----------------------------------------------------------------------------
Qualifying MWC multipliers are: 187884, 686118, 898134, 1104375, 1250205,
1460910 and 1768863. (We use the largest one that's < 2^21)
============================================================================

Installation
------------

$ pip install uheprng


Usage
-----


from uheprng import UHEPRNG

uheprng = UHEPRNG()

print uheprng.string(25)

random_byte = uheprng.bytes(1)

To Generate a meg of randomness in a file...

fo = open("foo.txt", "wb")

buf = str()
for i in range(0,1):
	for m in range(0, 64*1024*16):
   		buf += chr(uheprng.random(256))
	fo.write(buf)
	fo.flush()
	buf=str()

fo.close()
   

About

Pure Python Ultra High Entropy Pseudo Random Number Generator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages