Just concatenating strings doesn't work.
Keccak::hash(10 . $address, 256)
is what I'm doing atm.
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityActually 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.