Fast random
Table of Contents
/dev/urandom
is slow
/dev/urandom:
$ time head -c 1G < /dev/urandom > /dev/null
real 1m37.754s
user 0m0.048s
sys 1m37.684s
frandom:
$ time frandom | head -c 1G > /dev/null
real 0m2.704s
user 0m2.192s
sys 0m2.332s
That's 10.3 mb/s to 370 mb/s
-
Generate iv/key with
crypto/rand
-
Spam AES-OFB
-
Reseed after a MB has been generated
go get -u github.com/ammario/frandom/cmd/frandom
if [ -z "$GOPATH" ]; then
sudo cp ~/go/bin/frandom /usr/bin/frandom
else
sudo cp $GOPATH/bin/frandom /usr/bin/frandom
fi
frandom
appears to outperform crypto/rand
Run entropy.sh
to test frandom's entropy. (the dieharder tests will take a while to run)
See entropy.txt
for my test results.
Entropy tests appear ok but I'm not a crypto-man so maybe use this with caution.