Skip to content
monicanagent edited this page Nov 17, 2014 · 2 revisions

The RNG class is the cryptographically secure pseudo-random number generator for the cryptosystem.

The RNG class uses two sources of entropy:

  1. The cryptographically secure pseudo-random number generator provided by the operating system - CryptGenRandom() on Windows, /dev/random on Mac OS X and Linux, /dev/urandom on Android, and SecRandomCopyBytes() on iOS.
  2. A measured timer interval delta, expected versus actual, that fills and cycles a local entropy "stream" buffer with transformed data from source 1. The SHA256 function from the included as3crypto library is used in this step.

The RNG class currently provides three main cryptographically secure native data outputs: getRandomReal, getRandomInt, and getRandomUint. To improve performance the "stream" buffer may be paused and restarted as required.

Source code and inline documentation: https://github.com/monicanagent/cypherpoker/blob/master/Libraries/P2P3/CryptoWorker/src/crypto/RNG.as

Clone this wiki locally