From owner-freebsd-hackers Mon Jul 31 13: 1:34 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.40.131]) by hub.freebsd.org (Postfix) with ESMTP id D4BC537BC22 for ; Mon, 31 Jul 2000 13:01:18 -0700 (PDT) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.9.3/8.9.3) with ESMTP id WAA05926 for ; Mon, 31 Jul 2000 22:01:01 +0200 (CEST) (envelope-from phk@critter.freebsd.dk) To: hackers@freebsd.org Subject: How to make *real* random bits. From: Poul-Henning Kamp Date: Mon, 31 Jul 2000 22:01:01 +0200 Message-ID: <5924.965073661@critter.freebsd.dk> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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).)`QC4UKC(T[2]+UCAN:UMZ,_3]ZY MR=#K6QCE%H8-@34$03"$!?!PT'LQ\)>BP[61HP1$5IH"_C&F]5=;EENALI8Z M2'W`9Q-@AQ]UD.ZBONLN['"-9(]+D'/%R:MTQ,LKS&8496,W@P$?>ZC0!@.+ MMW=LM)\61/_<_+]EU3#8F1.2X6INC$^92%'T3VJ4?O%Q$)O/\R:+'G`F/!0K M&="/`F4AB'6["JQ]3=J%#^\&S8D>E]X-.S:_B=M_U.*=&]Q MXM\_JVB>HT9DEAM8+9@@4`MA[_3W:;"LCA/%W=0;5_K8(WC M4T";DDT,2D#E06D9>A&*FGR*6_MD#C:Z""_D#4#H-9#VC-W(X"MS50Z:R7N= M,PW!A!$=YQ*D;P*$J$=2P4\$NYR_Y4KD[FG(OEW!U,31-N2&S^<]MGDMA?8QO#WQV\,N_IX"6,6<*BM>']?IV=$!-5ATDCJHH"AF*GW MZR?.7.\-_LO6PQVU4+>F%)=NBV!9*ZBO(`V/66\+ZYM;(>FX5TV'.=4MHOC; M.IU*B([(\^ILO3NE6H,PC#T0\YWBG6@H?XXE MO\W<)$';`8KEC&LNU1DJ7E-ZDAT::_,FM@LPPATIH+Y69;J7BURX@3E8#34_)98)>C9;HK+ M?O3"JWA#-_Q5+@O$'M)\FY'[M61XUWZ+E*/_3WW<0(=Y^T4+H@V\3AEFE=S# MQJ%H=OD:%@A.3(3D0>^X'K@')[HP&H!OLRG72!5E8M*>9D'QB#ZO.!UF.K9< MPC`0.(6#S=P#2.3LV4:W=[TZPK42&)RR5`:8\4R8M#M#7,Y:V6.J`+WQ>-8$ M?$-R*K'B^*7.8VR3`+A!C*O5U0M%X>$VT!?L1A#K,L8_\`F^'SH=:(2C,MU9 M;.Q@(>4;'^0='>82?6\57>&+1/,'?%4R./'AKXJR>1Z8CCA`,#+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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