As a result of the apparently poor numerical distribution observed rolling my hex dice (see this earlier post), I was inspired to create an app to take the place of hex dice for the purpose of creating off-line Bitcoin private keys.
Bitcoin Key is now in the iOS App Store.
(At present it’s available only in the U.S., until I can figure out if it’s exempt from U.S. export regulations.)
The app generates a never-ending stream of random hexadecimal digits. The timer in the top-left corner counts down to the next digit, with a new one every two seconds. The previous digit is also shown here.
Move your finger around the screen to add your own randomness.
To create a Bitcoin private key, simply jot down (or enter into your offline computer running a live CD) 64 of the randomly-generated hexadecimal digits.
Worried that the app is recording every single digit produced and sending it somewhere? It’s not. You’re welcome to watch the wi-fi or your home network with a packet sniffer. Besides, even if it was, the collector of the data would have know way of knowing which of the endless stream of digits you’re actually writing down. Heck, maybe you’re only using every 2nd or 3rd digit produced.
Bitcoin Key uses ANSI X9.31 cryptographically secure random number generation via 256-bit AES in counter mode. The 256-bit key that’s fed into the AES comes from the system’s entropy source (SecRandomCopyBytes on iOS). The RNG is re-keyed from system entropy every minute (the timer in the top-right corner).
AES takes a 128-bit block as input. ANSI X9.31 specifies that this is to be a monotonically increasing value for secure random number generation. For this value, Bitcoin Key uses the system’s high-resolution timer (mach_absolute_time on iOS) as the upper 64 bits, and the user entropy value as the lower 64 bits.
The user entropy value is computed as follows: any time finger motion on the screen is sensed, the x,y coordinates of the finger are multiplied together, and the result is then added to the user entropy value.
Is it better than rolling dice? It depends on how you define “better.” Bitcoin Key includes a stats page that shows you a count of how many times each digit has appeared. I personally find that it has more even distribution compared to the hexadecimal dice I used previously.
And, at $0.99, Bitcoin Key is certainly cheaper than the dice I purchased. Although admittedly, hexadecimal dice have a certain charming appeal, and are a great conversation piece. 🙂