3

Is it possible to have a mapping in Solidity with a hash as key?

For example:

mapping (hash => uint) hashToInt;

If not, is there any way to group some information and put it as a key of a mapping?

4

Yes, hash was an old type that's been replaced with bytes32. You can call sha3(data1, data2, ...) and use that as a key.

There's still some open discussion on hash.

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.