linux – How can I convert a SHA256 hash into a Bitcoin base58 private key?

Free Bitcoins: FreeBitcoin | BonusBitcoin

Coins Kaufen: Bitcoin.deAnycoinDirektCoinbaseCoinMama (mit Kreditkarte)Paxfull

Handelsplätze / Börsen: Bitcoin.de | KuCoinBinanceBitMexBitpandaeToro

Lending / Zinsen erhalten: Celsius NetworkCoinlend (Bot)

Cloud Mining: HashflareGenesis MiningIQ Mining


How can I take the output of sha256sum

sudofox@ubuntu:~$ echo -n 'Hi guys!' | sha256sum
7542fb6685f9fd8f37d56faf62f0bb4563684a51539e4b26f0840db361e0027c  -

and turn it into a Base58Check encoded private key?

I need to be able to do this with a list of SHA256 keys. Is there a script I can download, or must I spend a few weeks making it just so I can make my temporary addresses?

In response to first comment:
No, I must input a string, like “fluttershy”, for example, into sha256sum and then I must encode the output of sha256sum into a base58check private key.

string –>sha256sum –> some automagic process, which is the purpose of this question –> bitcoin private key.

Update: For anyone wanting to use Grondilu’s Bitcoin Bash Tools: You need to source the bitcoin.sh file after extracting it into your directory to use the functions.

source ./bitcoin.sh

Update 2 (Aug 2017): Rewrote script to go from step 1 to WIF in one go. You can just add the declaration of base58 and the encodeBase58 functions from bitcoin.sh if you want to skip the rest of the lib.

#!/bin/bash
#Tool to convert bitcoin privkeys into WIF keys
# by sudofox

source ./bitcoin.sh

KEY=$1 # first arg

# add 0x80 to beginning
EXTENDEDKEY=$(echo 80$KEY)
FIRSTHASH=$(echo -n "$EXTENDEDKEY" |xxd -r -p |sha256sum -b|awk '{print $1}')
SECONDHASH=$(echo -n "$FIRSTHASH" |xxd -r -p |sha256sum -b|awk '{print $1}')
CHECKSUM=$(echo $SECONDHASH|cut -c1-8)
FINAL=$(encodeBase58 $EXTENDEDKEY$CHECKSUM)
echo $FINAL

The usage would be

./sha256_to_privkey.sh key

where in my example (see Stephen Gornick’s answer), key would be

807542FB6685F9FD8F37D56FAF62F0BB4563684A51539E4B26F0840DB361E0027CCD5C4A8E

Do the same thing for the various functions, modifying as needed. Hope this helps anyone struggling to use the tools.

Source link

Free Bitcoins: FreeBitcoin | BonusBitcoin

Coins Kaufen: Bitcoin.deAnycoinDirektCoinbaseCoinMama (mit Kreditkarte)Paxfull

Handelsplätze / Börsen: Bitcoin.de | KuCoinBinanceBitMexBitpandaeToro

Lending / Zinsen erhalten: Celsius NetworkCoinlend (Bot)

Cloud Mining: HashflareGenesis MiningIQ Mining

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close