I'm trying to check an hashed message inside my Solidity smart contract. In JavaScript I hash the message as follows:
util.sha3(Buffer.concat([
new Buffer(address1),
new Buffer(bytes32),
new Buffer("0"),
new Buffer(address2),
new Buffer("0")
])).toString("hex");
When I check in Solidity I do
keccak256(id,ca,dataHash, false, address(0), false);
I've tried both with keccak256
and sha3
, but both yield a different hash than the one produced in JavaScript. I'm suspecting some encoding issue (probably due to Buffer
doing something different than Solidity), but I can't find anything about that.
Note that I'm not signing anything, so the issue described in this question should not apply (at least, not as I understand the answer and documentation)