Use bytes.concat in MessageHashUtils by frangio · Pull Request #4504 · OpenZeppelin/openzeppelin-contracts (original) (raw)

FYI, I considered that change in #4296, but was not sure because of the casting.

both

keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message));

and

keccak256(string.concat("\x19Ethereum Signed Message:\n", Strings.toString(message.length), string(message)));

should work. Any reason to favor the first one ?