2

Just concatenating strings doesn't work.

Keccak::hash(10 . $address, 256) is what I'm doing atm.

0

Actually you can concatinate strings simply as shown in the question (that's what abi.encodePacked is doing).

However, my problem was with numbers.

This is because solidity's sha3 function hashes its inputs based on the 
argument types. Thus the value 1 will generate a different hash if it is 
stored as bytes8, bytes16, bytes32, etc. Since sha3(1) is being passed 1 as a 
number literal, it is converted into the smallest necessary type, uint81.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.