Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 38 lines (24 sloc) 1.083 kb
95686df Vincent Hanquez initial commit. code mostly forked off tls srandomgen
authored
1 CPRNG-AES
2 =========
3
4 This module provides a crypto pseudo random number generator using AES in counter mode.
5
6 to import:
7
8 import Crypto.Random.AESCtr
9
10 to use:
11
12 rng <- makeSystem
13 let (ran, rng') = getRandomBytes rng 1024
14
15 it's also an instance of CryptoRandomGen from the crypto-api package.
7e65107 Vincent Hanquez add some statistics
authored
16
17 Statistics
18 ----------
19
20 Using ent, a randomness property maker on one 1Mb sample.
21
22 cprng-AES:
23
24 Entropy = 7.999837 bits per byte.
25 Optimum compression would reduce the size of this 1048576 byte file by 0 percent.
26 Chi square distribution for 1048576 samples is 237.02.
27 Arithmetic mean value of data bytes is 127.3422 (127.5 = random).
28 Monte Carlo value for Pi is 3.143589568 (error 0.06 percent).
29
30 Compared to urandom with the same sampling:
31
32 Entropy = 7.999831 bits per byte.
33 Optimum compression would reduce the size of this 1048576 byte file by 0 percent.
34 Chi square distribution for 1048576 samples is 246.63.
35 Arithmetic mean value of data bytes is 127.6347 (127.5 = random).
36 Monte Carlo value for Pi is 3.132465868 (error 0.29 percent).
37
Something went wrong with that request. Please try again.