I started toying around with the idea of capturing randomness for a source of good n-length random passwords. There are numerous PRNG and TRNG sources out there to make an endless stream of random passwords to use, so this was mostly just an effort in light curiosity.
I thought about a good “fat” source of potentially random data, what did I have on me that could generate a nice big file? My iPhone can do it, specifically the camera. However, I need something random, so I marked up a checkerboard using a piece of paper and cut it into little squares. I put it all in a styrofoam cup and shook the daylights out of it. Dumped the paper from the cup onto my desk and spread out all the paper. Then I took a shot with my iPhone.
This created shot1.jpg. It’s a file with 1,893,984 bytes to it. Since the paper marks will never be in that arrangement ever again, I’d say it’s a pretty good source of randomness.
Next up, I used the shuf command to shuffle the lines of the image together, on a Mac I only had access to GNU’s coreutils via homebrew, so for me it’s:
gshuf shot1.jpg > shot1.rnd.
Then to turn the data into text, I thought about base64 encoding. The command was:
base64 -b 20 shot1.rnd > randpass1.txt
This created a text file with 126,266 lines. Since each line is a password, that’s my next 126,266 passwords. They look something like this:
Gkmd12A/IecVMjSsNnzS 45BrC+HsYh0X7VGzFnXD gLRhg3NaF5kQAiMZHb1r 0IvqeO63YEyG7U7y0jFl p+1Bi/Xrnj8PpWlkYX1s
Finally, with the text file handy and in a safe place, I’ll always have a nice random 20-character password handy for quite some time.
So of course, at the end, cleaning up using gshred, but on a journaled file system like HPFS on my Mac, chances are some parts of the data may hang around for a while. However, I was never seriously going into it, so technically a plain delete is good enough, but anyways:
gshred -n 3 -z -u file.ext