A command line app that prompts the user to enter inputs from coin flips, or 4, 8, or 16-sided dice and turns them into a hexadecimal string. Prompted by my own desire to create a cryptographically secure Bitcoin private key offline using dice, and my unhappiness with relying on SHA-256 to produce truly random output, as "dice-wallet" does.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
.gitignore
LICENSE
README.md
bitcoin.sh
keygen.c

README.md

dice-keygen

A command line app that prompts the user to enter inputs from coin flips, or 4, 8, or 16-sided dice and turns them into a hexadecimal string. Prompted by my own desire to create a cryptographically secure Bitcoin private key offline using dice, and my unhappiness with relying on SHA-256 to produce truly random output, as "dice-wallet" does.

Build instructions:

gcc -o keygen keygen.c -std=c99

If you are using this utility to create a Bitcoin private key, specify a bit length of at most 256 when prompted. Also, make sure that the generated hexadecimal string is not larger than FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141, which is the maximum value that can be turned into a Bitcoin private key, according to the wiki.

Bitcoin Examples

Getting a Bitcoin address and importable private key (WIF) from a 256-bit private key using pycoin (cross-platform):

$ python
>>> from pycoin.key import Key
>>> k = Key(secret_exponent=0xFFFF562F8F9A961E158BDE2D4CCD2A64BB1D923208939714675BFAB28BBAF2A3)
>>> print k.address()
1Cj9a8z4r7yoHcMB87LAd5dMJbeb4dFTYt
>>> print k.wif()
L5oLTsjGYwq8Suef1c5jDc6kLbYS6LG1VG7E1kFoN4hg2sVNoW3W
>>> 

Getting a Bitcoin address and importable private key (WIF) from a 256-bit private key using bitcoin.sh (Linux-only):

$ source bitcoin.sh
$ newBitcoinKey 0xFFFF562F8F9A961E158BDE2D4CCD2A64BB1D923208939714675BFAB28BBAF2A3
---
secret exponent:          0xFFFF562F8F9A961E158BDE2D4CCD2A64BB1D923208939714675BFAB28BBAF2A3
public key:
    X:                    CAFA2E819FFB11C209651801A47E574A330BDEEF805FB2689A1C2ADE3512F9B4
    Y:                    0AF853CFBECD031DBB5CAF3EE77CD35587D9CCA244B8F28910FC426E01C3E716
compressed:
    WIF:                  L5oLTsjGYwq8Suef1c5jDc6kLbYS6LG1VG7E1kFoN4hg2sVNoW3W
    bitcoin address:      1Cj9a8z4r7yoHcMB87LAd5dMJbeb4dFTYt
uncompressed:
    WIF:                  5Km2h5F7F312grYBstSzbaKyVTQSApQnsovX8saiKNEHzzX2psz
    bitcoin address:      1Q7anhn5mgRHTivdujHeSVyRkeAtBmw8K7
$ 

Credit for bitcoin.sh goes to Lucien Grondilu's bitcoin-bash-tools.

NOTE: As of 2014-09-25, I've switched the endianness of the key generated by the dice rolls and changed the scheme for handling any "extra" bits generated by your RNG. This should be of no consequence to anyone since this utility is meant to product random strings, but I'm pointing it out in this push because it may be of consequence to you if you've been using this tool for something other than its intended purpose.