-
Notifications
You must be signed in to change notification settings - Fork 1.7k
web3_sha3 is return incorrect hashes #2507
Comments
Parity is hashing raw bytes not strings. Don't see a point of hashing a string instead of bytes:
|
I think you can use Also please test with |
sha3 is used for address capitalization, so that for example: Capitalized for sumcheck validation is: Where the corresponding character in the sha3 hash it used to determine if the character in the address should be upper or lower case. If using the Parity hash it would result in a different set of uppercase characters. And the resulting address would appear as invalid. (Note it was running parity in --geth mode when testing) |
So you need to encode the string Running:
results in expected hash. I believe geth's behaviour should be the same - it's just |
Ok great, thanks, got it. |
When using Parity "web3_sha3" call over RPC it is return hashes that do not match keccak-256 hashes generated by other tools.
For example in Parity:
curl -s -X POST 127.0.0.1:8545 --data '{"jsonrpc":"2.0","method":"web3_sha3","params":["0x7ee1cc30f12731068b31c440512b8aaa44277ab7"],"id":1}' -H "Content-Type: application/json"
Returns:
0xd1dfd81cc922f8d23d3fc2a9e402eb814d80aca61bc0061838a67404526da305
In GETH console:
web3.sha3('0x7ee1cc30f12731068b31c440512b8aaa44277ab7');
Returns:
0x553a9ec495cafcb7c037c18d3afd3a60be1e0cbd5c16fbb13ea3480789328630
This online hashing tool agrees with GETH:
http://emn178.github.io/online-tools/keccak_256.html
The text was updated successfully, but these errors were encountered: