soliditySHA3 multiple bytes32 encoding issue
See original GitHub issueIt seems soliditySHA3 does not handle properly case when multiple bytes32 are involved. Steps to reproduce below:
abi.soliditySHA3([ "bytes32", "bytes32" ], [ "Volume", "Volume" ]).toString('hex');
returns:
8239dae94d559efaf979a8ffdb349ed1d13c6636d28ab641f43ae2bc0c0b985a
Yet,
contract TestTightHash {
function coded() constant returns (bytes32) {
return keccak256(bytes32("Volume"), bytes32("Volume"));
}
}
coded() returns 0x7ab276f38b269dc879fb051ca72ac238c1a03c2db62bbd7a499c1dd822c3e020
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Solidity's keccak256 hash doesn't match WEB3 keccak hash
It could be an encoding issue, but I'm not sure how to fix it. I was trying to hash three parameters like this:...
Read more >Solidity and web3 sha3 - javascript - Stack Overflow
When Javascript gets the return value from the contract it expects a UTF8 string, but inside your hashedToken you have byte values that...
Read more >Nethereum/Nethereum - Gitter
you can do Nethereum.ABI.ABIType.CreateABIType("bytes32").Encode() ... sample it is a bit hard to see what you are doing :), but I assume that is...
Read more >web3.utils — web3.js 1.0.0 documentation - Read the Docs
This means arguments will be ABI converted and tightly packed before being hashed. The difference between this function and the soliditySha3 function is...
Read more >How to Hash Data Without Errors (part 3) - Coder's Errand
In this installment, I bring the same issues to the realm of smart ... There are two things we have to specify when...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
New npm release is out: https://www.npmjs.com/package/ethereumjs-abi
Sorry for the delay, will close now.
Also confirming this issue, you must install from master for
soliditySHA3
to work properly. I recommend publishing the latest version to npm.