Dan Kaminski (@dakami) tweeted a cool, small (11 instruction) TRNG generator called Jytter Friday:
http://t.co/ar74sHcv 11 instruction TRNG. wow
— Dan Kaminsky (@dakami) August 25, 2012
The authors have Windows & Linux ports but no OS X port (and, I play mostly on OS X when not in virtual environments). So, I threw together a quick port of it to OS X. It should work on Snow Leopard or Lion, but YMMV.
You need to install nasm
via a quick brew install
then copy linux32_build.sh
to osx_build.sh
and change the nasm
and gcc
lines to be:
nasm -D_32_ -O0 -fmacho -ojytter.o jytter.asm nasm -D_32_ -O0 -fmacho -otimestamp.o timestamp.asm gcc -D_32_ -m32 jytter.o timestamp.o -o demo -O2 demo.c
I ran the resultant demo
binary and got:
True random integers: 64-bit: 10DE4A7EA676A869 128-bit: E2B9F86CADC854B540090E125A7C7611 256-bit: 7F3AC590F6EE2AC13F136B802BEBCC8323CB26665BC354CDAC488ED86E153641 True random passwords: 66-bit: OEqQaY8UQeO 132-bit: Gwi9DCMtFy7XzHWHII37Hj 258-bit: TPzqJfLL84Mjq3VZXpQDW0.WhWSFq2HA9X6FL7GSjaX Execution time in CPU ticks: 000000004397D59A
which tracks with the linux output I received (obviously not the same values) from the demo program on one of my non-VPS linux nodes.
Russell Leidich (the author) did some really impressive work here. I did virtually nothing (just enabled playing with it on OS X). The posts at the Jytter site are well worth the time spent absorbing.