Use bytes.concat in MessageHashUtils (#4504)

This commit is contained in:
Francisco
2023-08-02 15:45:39 -03:00
committed by GitHub
parent 5ae630684a
commit d39df78f6c
2 changed files with 5 additions and 2 deletions

View File

@ -2,4 +2,6 @@
'openzeppelin-solidity': minor 'openzeppelin-solidity': minor
--- ---
Replace some uses of `abi.encodePacked` with clearer alternatives (e.g. `bytes.concat`, `string.concat`). Replace some uses of `abi.encodePacked` with clearer alternatives (e.g. `bytes.concat`, `string.concat`). (#4504)[https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4504]
pr: #4296

View File

@ -46,7 +46,8 @@ library MessageHashUtils {
* See {ECDSA-recover}. * See {ECDSA-recover}.
*/ */
function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32 digest) { function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32 digest) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(message.length), message)); return
keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message));
} }
/** /**