Using a book cipher to generate bitcoin addresses

21 September 11

This article describes a process for creating bitcoin addresses from a book cipher. The private key of the Bitcoin address can be re-generated in the future as long as you remember the book or text you used.

Book ciphers

A book cipher Book Cipher - Wikipedia is a cipher in which the key is some aspect of a book or other piece of text.

There are several ways to use a book to create a coded message. For instance the Beale code uses the word number to encode the location of hidden treasure.

The Beale code is said to contain the location of hidden gold

What is a Bitcoin address exactly ?

Bitcoin is based on public key cryptography. Generally you would have a digital wallet containing a number of cryptographic keypairs. A key pair contains a public key and a private key. People can make payments to your public key address and you can spend them by using your private key address.

Every Bitcoin private key is a 32-byte hex number and any 32-byte hex number can be used as a Bitcoin private key. The public key of a Bitcoin address is a hash of the private key using the RIPMD-160 hash algorithm.

An example Bitcoin key pair generated by vanitygen is shown below. (Vanitygen uses Base58 to display the private key.)

$ ./vanitygen 1Boat
Difficulty: 4476342
Pattern: 1Boat
Address: 1BoatSLRHtKNngkdXEeobR76b53LETtpyT
Privkey: 5J4XJRyLVgzbXEgh8VNi4qovLzxRftzMd8a18KkdXv4EqAwX3tS


We can use the SHA256 algorithm to generate Bitcoin private keys.

The SHA256 hash algorithm coincidentally will produce a 32-byte hex number from any text input. An example using unix runs as follows.

echo -n My Hopefully Unique Passphrase | sha256sum
61dac1f35d9ae2854a2e0ce40745837e83e1f3d918fe28bff772560fa009ff4b

or, we can run this through gpg.

echo -n My Hopefully Unique Passphrase | gpg --print-md sha256
61DAC1F3 5D9AE285 4A2E0CE4 0745837E 83E1F3D9 18FE....

So we have a way of generating Bitcoin private keys with a passphrase. Let's go one step further and use a book cipher to create a passphrase and then the corresponding key is the reminder for that passphrase key so that 5 years down the line as long as we can remember what book we used we can use the book cipher key to generate our passphrase.


Passphrase book cipher example

I'm going to use a page number/line number/word number syntax to describe my passphrase. So I pick a book from my book shelf and I flick through and pick a few random words.

395/4/2 200/5/1 401/1/1 12/12/2    28/10/1 
the     which   dies    responded  mobile

Turn the passphrase into a bitcoin private key.

echo -n the which dies responded mobile | sha256sum
5c50a299bdf724738e837817ba790e4853bb0cd7f08cf44f6c34a5f69c273aa9

I can then use a base conversion tool Such as this one to convert the Base16 (Hexadecimal) address to Base58, which gives me.

6Xv0vGpbh6TgUDZA9mXUVGRNHEusZiDCSSOQ4ruELNl1

Importing the private key into the Bitcoin client

Currently the bitcoin client doesn't support private key import although there is a pull request to implement this functionality. There are also a bunch of tools that can work directly on a wallet.dat file for key import. e.g. PyWallet.

Bitcoin tools has functionality to create Bitcoin addresses from a sentence and also has a facility to download a wallet.dat so the coins can be spent.


Creating book cypher keys with Brand

Use the "Generate key from a sentence" feature in Brand to create a key pair. Brand has a clue field which is a place to store a reminder of your strong password. In this case you could enter your page and word keys for storage.


Generating a paper wallet with Brand

If you select the "Generate Paper Wallet" option on the accounts page of Brand you'll get a PDF document of your accounts. This is useful backup of your accounts as you can retrieve your Bitcoin keys independently of Brand .


Give Us a Try!

129,484 people trust their Bitcoins with StrongCoin.

Get Started

All trademarks and copyrights held by respective owners.