Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: millemile on January 29, 2018, 03:43:52 PM



Title: A Technical question about ScriptSig
Post by: millemile on January 29, 2018, 03:43:52 PM
Guys, I'm trying to fully understand the raw transaction hex data but got stuck at the scriptsig to publickeyhash part.
For example, in "txid": "1f1cb87e2d81582c5e39e8d7f78286c22835827359ed96976135407bda7202e2" the input compressed public key is "037cb4433473b8a644b89c6932f648c0ccc2c6974ffa0df57c6337a397cc024ed2". OP_HASH160 should convert it into its previous output ("txid": "0db0cb2986024d4555515e530cd3ff564fb267faaaf73ea266fd80a54f478368", "vout": 4,) public key hash "32fb2cfd2ac1104e68aa93d6992c89ae78f752b9".
I used first SHA256 and then RIPEMD160 on this website: http://www.md5calc.com/ to do the OP_HASH160 manually, but the results never match.
Please educate me where's the problem. Thanks in advance!


Title: Re: A Technical question about ScriptSig
Post by: Coding Enthusiast on January 29, 2018, 03:51:09 PM
These websites treat the input as an String but your input is a Hex. You either have to write your own code that accepts Hex or if you want to use an online tool, find something that has an option to accept Hex.

Edit: Here is a tool: http://extranet.cryptomathic.com/hashcalc/index
Public Key: 037cb4433473b8a644b89c6932f648c0ccc2c6974ffa0df57c6337a397cc024ed2
First hashing using Sha256: 6e9f13f108af57fcf21a2c14f00474947573ecd9c4bbafa692f44a748c1d4c71
Second hashing using Ripmed-160 on previous result: 32fb2cfd2ac1104e68aa93d6992c89ae78f752b9
Which is the correct result.


Title: Re: A Technical question about ScriptSig
Post by: millemile on January 29, 2018, 04:03:10 PM
These websites treat the input as an String but your input is a Hex. You either have to write your own code that accepts Hex or if you want to use an online tool, find something that has an option to accept Hex.
Many thanks! I found one here (http://extranet.cryptomathic.com/hashcalc/index) and it works very well.


Title: Re: A Technical question about ScriptSig
Post by: Coding Enthusiast on January 29, 2018, 04:08:33 PM
These websites treat the input as an String but your input is a Hex. You either have to write your own code that accepts Hex or if you want to use an online tool, find something that has an option to accept Hex.
Many thanks! I found one here (http://extranet.cryptomathic.com/hashcalc/index) and it works very well.

Yeah, found the same thing. Added to my previous post with an edit :)
here is another one:
Step1: https://www.fileformat.info/tool/hash.htm?hex=037cb4433473b8a644b89c6932f648c0ccc2c6974ffa0df57c6337a397cc024ed2
Step2: https://www.fileformat.info/tool/hash.htm?hex=6e9f13f108af57fcf21a2c14f00474947573ecd9c4bbafa692f44a748c1d4c71
RipeMD160 result is: 32fb2cfd2ac1104e68aa93d6992c89ae78f752b9