Hsbx HardwareRNG

From Hackerspace Brussels
Jump to: navigation, search
Hsbx HardwareRNG
[[Image:{{{picture}}}|200px]]
What:
HardwareRNG
Tagline:
noisy naughty noise
Maintainer(s):
Jegeva
Archived:
yes



Why[edit]

  • Generate Cryptostrong randomness and feed /dev/hw_random (or other things)

via USB makes collide :

    • electronics
    • software
    • crypto goodness
  • Multiple designs are available online, want to compare randomness quality
  • Have a bunch of tiny45 i want to find a use for
  • Because i can (try)...

What[edit]

some transistors, some caps, attiny45

How[edit]

Where am i ?[edit]

ATM @ Jege home, beeing tested

Grumbles, Notes[edit]

v1 generation is "a bit" biased : ent :

Entropy = 7.977742 bits per byte.
Optimum compression would reduce the size of this 2355200 byte file by 0 percent.
Chi square distribution for 2355200 samples is 62743.07, and randomly would exceed this value 0.01 percent of the times.
Arithmetic mean value of data bytes is 134.1802 (127.5 = random).
Monte Carlo value for Pi is 3.000950239 (error 4.48 percent).
Serial correlation coefficient is -0.000289 (totally uncorrelated = 0.0).
 

exceed this value 0.01 percent of the times -> Completely unfit for crypto purposes...

exemple for /dev/urandom :

Entropy = 7.999995 bits per byte.

Optimum compression would reduce the size of this 31457280 byte file by 0 percent.

Chi square distribution for 31457280 samples is 232.09, and randomly would exceed this value 75.00 percent of the times.

Arithmetic mean value of data bytes is 127.5220 (127.5 = random).
Monte Carlo value for Pi is 3.139891052 (error 0.05 percent).
Serial correlation coefficient is -0.000201 (totally uncorrelated = 0.0).
 

i suspect the output from the sn74als04an (0 -> vcc-2) to weirdly interract with the binary reading on the tiny45 (0 if(v<0.3*vcc), 1 if(v>0.6*vcc), "random" otherwise, vcc =5) 5*.6 = 3v which is the peak value to ensure the reading of a 1. Non von-neuman* decorrelated reading from the tiny read a LOT of 0s...

i'll try to think about a v2 that outputs a 0-5v square signal. (will try something along the line of the jfet link, eliminates the sn74 for another 3904, seems the output should be 0-4.5v)

if the output is still biased maybe some shielding... wish i had more of those in stock already...



  • to read 1 decorrelated byte :
result = 0;
for(i=0;i<8;){
	do{
	oldreadc= (PINB & _BV(LED0_BIT));
	readc = (PINB & _BV(LED0_BIT));
	}while(oldreadc ^ readc == 0);
	result |= readc << i;
	i++;
      }
 

Online resources[edit]

Darn, the idea was in the air it seems... well, will learn more with the desing presented here...