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 Answers1

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.

eth
  • 85,679
  • 53
  • 285
  • 406