Skip to content

Instantly share code, notes, and snippets.

@davout
Created November 24, 2013 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davout/7629736 to your computer and use it in GitHub Desktop.
Save davout/7629736 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'securerandom'
require 'bitcoin'
require 'digest'
LIST = './wordlist.txt'
ROLLS_PER_WORD = 5
DICE_FACES = 6
WORDS_PER_PHRASE = 12
def roll
(SecureRandom.random_number * 6).ceil
end
def passphrase_to_brainwallet(passphrase)
# TODO : Check key for acceptable range
k = Bitcoin::Key.new(Digest::SHA2.hexdigest(passphrase))
bwallet = <<-EOS
Passphrase: #{passphrase}
Private key (hex): #{k.priv}
Private key (b58): #{k.to_base58}
Address: #{k.addr}
EOS
puts bwallet.gsub(/^\s*/, '')
end
passphrase_to_brainwallet(ARGV.join(' '))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment