On 2nd of October 2015 I have published a "CISPRNG" on sci.crypt-random.
It can be seeded with any arbitrary 128bit value and produce a 32bit output.
It also uses only cheap arithmetic operations, like bitwise shift,
additions and XOR. The internal state of 160 bit does not need any
predefined constant values.
It is released under the free BSD license.
It passes all statistical tests without failure. The formulae below
passes Qualcomms's bias test, John Walker's ENT, Maurer's Universal test
for random bits, show a well uniform distribution regarding Winston
Rayburn's bit analysis and pass all tests off Pierre L'Ecuyer's
testsuite TestU01, which are SmallCrush, Crush and BigCrush. Even a
reduced to 16bit version of bcd32 passed the before mentioned tests.
This is the formulae as ANSI-C snippet.
Please be aware that it should not be seeded with all vars equals 0.
static uint32_t a, b, c, d, t;
// The Seeding Function
void seed_bcd32(uint32_t seed[]) {
// check for a potential a==0
if (seed[0] > 0xfffffffe)) seed[0] = 1;
a = seed[0] ^ 0xffffffff;
b = seed[1];
c = seed[2];
d = seed[3];
t = a + b + c + d;
}
// The PRNG Function
uint32_t bcd32() {
a = a + (d >> 5);
b = a + (b ^ c);
c = a + (b << 13);
d = a + (d ^ t);
t = a + t;
return (b ^ c ^ d);
}
Some test results of bcd32
a = 1, b = 2, c = 3, d = 4
# Testsize 2**30 bit (128 MB)
../bcd32_BitStat 30 0 | BitStatistic/ent
Entropy = 8.000000 bits per byte.
Optimum compression would reduce the size
of this 536870912 byte file by 0 percent.
Chi square distribution for 536870912 samples is 270.82, and randomly
would exceed this value 23.70 percent of the times.
Arithmetic mean value of data bytes is 127.5036 (127.5 = random).
Monte Carlo value for Pi is 3.141336781 (error 0.01 percent).
Serial correlation coefficient is -0.000000 (totally uncorrelated = 0.0).
-----------------------------------------------------------------------------------
a = 219324720, b = 1108630788, c = 1189532544, d = 1548197085
# Testsize 2**30 bit (128 MB)
../bcd32_BitStat 30 65432912 | BitStatistic/ent
Entropy = 8.000000 bits per byte.
Optimum compression would reduce the size
of this 536870912 byte file by 0 percent.
Chi square distribution for 536870912 samples is 245.69, and randomly
would exceed this value 65.08 percent of the times.
Arithmetic mean value of data bytes is 127.5015 (127.5 = random).
Monte Carlo value for Pi is 3.141296860 (error 0.01 percent).
Serial correlation coefficient is -0.000033 (totally uncorrelated = 0.0).
-----------------------------------------------------------------------------------
# Seed =
3674308604 | a = 1064954296, b = 1558138774, c = 1222783100, d
=
2044543557
nice -n 19 ./TestU01_bcd32 -c
3674308604 3>&1 2>&3- | tee Crush.txt
========= Summary results of Crush =========
Version: TestU01 1.2.3
Generator: bcd32 32-bit
Number of statistics: 144
Total CPU time: 01:17:23.18
All tests were passed
# Seed = 167813656 | a = 798087881, b = 280156805, c = 1311267411, d
= 994191163
nice -n 19 ./TestU01_bcd32 -c 167813656 3>&1 2>&3- | tee Crush.txt
========= Summary results of Crush =========
Version: TestU01 1.2.3
Generator: bcd32 32-bit
Number of statistics: 144
Total CPU time: 01:13:08.81
All tests were passed
# Seed =
2028375283 | a = 1747968903, b = 537061761, c = 523248786, d
= 296811837
nice -n 19 ./TestU01_bcd32 -c
2028375283 3>&1 2>&3- | tee Crush.txt
========= Summary results of Crush =========
Version: TestU01 1.2.3
Generator: bcd32 32-bit
Number of statistics: 144
Total CPU time: 01:12:32.73
All tests were passed
nice -n 19 ./TestU01_bcd32 -b
2028375283 3>&1 2>&3- | tee BigCrush.txt
========= Summary results of BigCrush =========
Version: TestU01 1.2.3
Generator: bcd32 32-bit
Number of statistics: 160
Total CPU time: 08:26:48.66
All tests were passed
The source code for these tests can be found here
http://www.freecx.co.uk/bcd32/
Cheers,
Karl-Uwe
--- news://
freenews.netfront.net/ - complaints:
ne...@netfront.net ---