question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

soliditySHA3 multiple bytes32 encoding issue

See original GitHub issue

It 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:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
holgerd77commented, Dec 6, 2017

New npm release is out: https://www.npmjs.com/package/ethereumjs-abi

Sorry for the delay, will close now.

4reactions
thisbejimcommented, Jul 21, 2017

Also confirming this issue, you must install from master for soliditySHA3 to work properly. I recommend publishing the latest version to npm.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found