Private Key (decimal) To RIPEMD160 (h160)
Convert Decimal Number to RIPEMD160 (HASH160)
from secp256k2 import Contactor
cont = Contactor()
privatekey = 12345678901234567891234567891234567789
ripemd160 = cont.privatekey_to_h160(privatekey)
In the code snippet above, an instance of the Contactor
class from the secp256k2
library is created, which is a Python library that provides tools for working with Bitcoin's secp256k1 elliptic curve. A private key is defined as a long integer. Then, this private key is converted to a hash using the RIPEMD-160 algorithm by invoking the privatekey_to_h160
method of the Contactor
object. The output, ripemd160
, represents the RIPEMD-160 hash of the given private key. This process is a part of generating a Bitcoin address from a private key, where RIPEMD-160 is one of the several steps involved in the creation of a wallet address.
Last updated
Was this helpful?