Created
November 24, 2013 17:19
-
-
Save davout/7629736 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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