New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
op_hash160 misimplemented #14
Comments
except fix |
OP_SHA256 seems to suffer from a similar issue... |
looks like all hash op-codes aren't working... |
I can confirm this bug. "033a38474ff6bbbb7a3e84b8db49a1400d2cb63281636119aa85973b65d29e2592" should result in "f204e24e51ed8b17873e6e54148f70ec29ab5afc", but this program calculates "0x033A38474FF6BBBB7A3E84B8DB49A1400D2CB63281636119AA85973B65D29E2592". Looks like this project is dead, or the maintainer. Is this fixed in one of the 48 forks? |
You may find Bitauth IDE useful for debugging scripts. It's open source here: https://github.com/bitauth/bitauth-ide |
Just wanted to add that I've run into the same bugs with OP_HASH160 and OP_HASH256 |
Seems like https://vlad15june.github.io/bitcoinIDE/build/editor.html has fixed it. :) |
Ya. It seems to be fixed but might have broken other op_codes in the process.
|
Consider the script
74686973697361736563726574 op_hash160
.Answer expected: 0x835ca4a6a1c2baaaf63bf33c777aff2fc681b017
Answer returned: 0xa69008fd5d7297bed5b71fea578a770e150b2f92
Expected behaviour confirmed at https://www.indicrypto.com/bitcointools/tool/pubkey-to-hash, https://bitcoinprices.org/public-key-to-hash/ and by running through the current master at https://github.com/kallewoof/btcdeb.
The error derives from mishandling the preimages as ascii instead of binary.
In PHP the
hash()
function returns ascii formed as hexadecimal. Thus:A correct implementation converts the preimages to binary first:
Thanks!
The text was updated successfully, but these errors were encountered: