Bitcoin Forum

Bitcoin => Wallet software => Topic started by: manhquang2206 on April 07, 2019, 03:36:24 PM



Title: Asking for code to convert hex key to hash160 (Javascript without node.js)
Post by: manhquang2206 on April 07, 2019, 03:36:24 PM
May i ask if is there any javascript code to turn a hex private key into a hash160 output without require() using node.js. bitcoin code usually return base58 compressed or uncompressed address of a priv key but i hope to skip base58 convert of hash160 to save performance time. Thank You


Title: Re: Asking for code to convert hex key to hash160 (Javascript without node.js)
Post by: pooya87 on April 08, 2019, 03:39:12 AM
if you can't find the function in a library then do it yourself! the library must have a function to get a "public key" from your private key. use that and then simply hash the result (the pubkey) yourself using RIPEMD160(SHA256(pubk)).
and by the way base58 is not the bottleneck in this process the conversion from private key to public key is the slowest operation and in comparison base58 encoding time is nothing. so if you are trying something like brute force that needs efficiency then you might want to look into that part instead.


Title: Re: Asking for code to convert hex key to hash160 (Javascript without node.js)
Post by: manhquang2206 on April 08, 2019, 12:01:50 PM
if you can't find the function in a library then do it yourself! the library must have a function to get a "public key" from your private key. use that and then simply hash the result (the pubkey) yourself using RIPEMD160(SHA256(pubk)).
and by the way base58 is not the bottleneck in this process the conversion from private key to public key is the slowest operation and in comparison base58 encoding time is nothing. so if you are trying something like brute force that needs efficiency then you might want to look into that part instead.
I'm looking for a code without using external library, i found one on this https://bitcointalk.org/index.php?topic=750022.0 (https://bitcointalk.org/index.php?topic=750022.0) which can create random key but lack function to convert hex to key & can't call the  RIPEMD160() & Buffer(), the code calling method pretty different from bitcoinjs which is why i hope there're codes that can provide small functions at a time aside from this one