Date: Mon, 31 Jul 2000 22:01:01 +0200 From: Poul-Henning Kamp <phk@freebsd.org> To: hackers@freebsd.org Subject: How to make *real* random bits. Message-ID: <5924.965073661@critter.freebsd.dk>
next in thread | raw e-mail | index | archive | help
Ok, some people just can't leave an open end dangling (people like me for instance :-) I located a surplus german geiger counter cheaply [1], I have always wanted to have one anyway, and in my junkbox I already had an old smoke alarm [2]. The Geiger counter has a thin-walled tube which takes about 15 events per second from the Am-241 source in the smoke alarm. The earphone output of the geiger counter with a 1kOhm load generates a nice TTL level pulse which can be fed onto pin 10 of the parallel port and timestamped with the PPS-API device ("device pps"). I think the parallel port could even power the geiger counter so that batteries would be a non-concern. Random bits are bits where no possible estimation of the next bit is possible. Entropy bits are bits which it may be possible to estimate with a degree of uncertainty which is better than the statistical average. If I generate true random bits it takes 3 timestamps to get one bit of randomness: T1: Time of event 1 T2: Time of event 2 T3: Time of event 3 if (T2 - T1 > T3 - T2) return 0; else if (T2 - T1 < T3 - T2) return 1; else try again. In my rather crude setup it produces about 5 bits per second [3]. If the goal is to only provide entropy for a RNG (like Yarrow) we can get much more mileage from the same number events: if the average event rate is N events per second we can get roughly / T \ | timecounter | log2 | ------------- | \ N / ---------------------------- 2 bits of entropy per event, which in my case (233 MHz and 15 events per second) gives 12 bits per event or 180 bits of entropy per second. Not bad... Poul-Henning [1] At "http://www.Helmut-Singer.de/" Called "FH40T Satz 2". [2] Has to be an "ionization" type, otherwise it doesn't contain the Am-241 alpha particle source. [3] Feel free to analyze: begin 644 random.bin M8E6*C@L`HFI&I:/C=-8"7J).)`QC4<H_`_3YM9W8?JB&<5,!1SZ%&48PN48E MN]!*;VTMLK\FKH@@6QWJ6JF=01Z:V(*5C?VA_LN[47$*CDOTDMA-8T0-::2D M`_<7L5'-&8#GGOSV%X..@&NQR"G3WV]I;"%7>UKC(T[2]+UCAN:UMZ,_3]ZY MR=#K6QCE%H8-@34$03"$!?!PT'LQ\)>BP[61HP1$5IH"_C&F]5=;EENALI8Z M2'W`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,GU]AB/H#-Q?>VVW!UEY+&?< M^9BD@;21+&]:>QLCGU/QD$+5>8RQ9$B!!:SD9UOA=;#6=*C1G#7\*_!M7'E\ M8%6XS6LN*F<(_.)T0]:F?([`VOF-&:9?KN`=XSH(KA`>.-27(2G+[2H/NG75 M>M!=N`V]S\X@SE@3@:6*75I$H1%8L(7\1BI6_(,$N56J!7J=R-4**[Y]HI!3 MN4VFY3JRK9/K"_W@S5FK$B,M?[$>_4E>T_@&-7;>'7B\5##I2,^63/WHU<C: M`89]<;@`&>>QDUP+HK<`?A.V@;Y:;KW(:'F$.@E9Y(3)!MX)W$-G/HA+8E/O $)&.(Z[@` ` end -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD coreteam member | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5924.965073661>