0

Sha256 Message Digests are 32 bytes, however they are typically expressed as a 64 character string. Is it possible to map the string to an address?

Something like

mapping (stringToBytes32(bytes32) => address) public digestToAddress;

I'd rather not store the string and would like to store the byte32

1

would like to store the byte32

Yes, you can do that and just use bytes32 as the key:

mapping (bytes32 => address) public digestToAddress;

The 64 characters are the 32 bytes in hex.

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.