Last active
January 2, 2016 05:49
-
-
Save emre/8259715 to your computer and use it in GitHub Desktop.
converts asm hash to wallet address
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
from base68 import b58encode | |
import hashlib | |
def from_asm_hash_to_address(asm_hash): | |
key = asm_hash.split()[1] | |
sha = hashlib.sha256(key.decode("hex")).digest() | |
ripe160 = hashlib.new('ripemd160') | |
ripe160.update(sha) | |
d = ripe160.digest() | |
address = ('\x32' + d) | |
checksum = hashlib.sha256(hashlib.sha256(address).digest()).digest()[:4] | |
address += checksum | |
encoded_address = b58encode(address) | |
return encoded_address | |
print from_asm_hash_to_address("3045022100dd38dd4c48351ee544273e6c871baad33c0336711c6c5cede6a9fdbe7b296169022057fce2ad5c3814ba51006263d24d7200ad244b2720538233e8a5a8bb2e1bc46901 037e55ed6cd9fc683d23f2651797f544448c2507e32c5682d094657e561879dc06") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment