Skip to content

Instantly share code, notes, and snippets.

@konqueror1
konqueror1 / get_address_from_ripemd160.py
Created July 24, 2020 20:01 — forked from anddam/get_address_from_ripemd160.py
Get bitcoin address from RIPEMD-160 hash in python3
from hashlib import sha256
from base58 import b58encode
def get_address_from_ripemd160(ripemd_hash):
# steps from https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses
h3 = ripemd_hash
h4 = '00' + h3
h5 = sha256(bytes.fromhex(h4)).hexdigest()
h6 = sha256(bytes.fromhex(h5)).hexdigest()
h7 = h6[0:8]