Hash operations treat stack values as text
rapodaca opened this issue · 1 comments
rapodaca commented
OP_ADD appears to treat stack items as hex values, as expected:
0x0a 0x06 OP_ADD 0x10 OP_EQUAL
http://www.crmarsh.com/script-playground/#0x0a%200x06%20OP_ADD%200x10%20OP_EQUAL
However, it looks like OP_SHA256 (and OP_RIPEMD160) treats stack items as text. I expect this to fail (but it passes):
0x0a OP_SHA256 0xca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb OP_EQUAL
and this to pass (but it fails):
0x61 OP_SHA256 0xca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb OP_EQUAL
Ideas?
hrobeers commented
I suggest using bitcore's Script library. It is better maintained.
https://bitcore.io/api/lib/script
You can play with it here: https://bitcore.io/playground