Skip to content
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

Hash operations treat stack values as text #2

Open
rapodaca opened this issue Jul 8, 2016 · 1 comment
Open

Hash operations treat stack values as text #2

rapodaca opened this issue Jul 8, 2016 · 1 comment

Comments

@rapodaca
Copy link

rapodaca commented Jul 8, 2016

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

http://www.crmarsh.com/script-playground/#0x0a%20OP_SHA256%200xca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb%20OP_EQUAL

and this to pass (but it fails):

0x61 OP_SHA256 0xca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb OP_EQUAL

http://www.crmarsh.com/script-playground/#0x61%20OP_SHA256%200xca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb%20OP_EQUAL

Ideas?

@hrobeers
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants