Skip to content

Commit

Permalink
Use bytes.concat in MessageHashUtils (#4504)
Browse files Browse the repository at this point in the history
  • Loading branch information
frangio committed Aug 2, 2023
1 parent 5ae6306 commit d39df78
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .changeset/flat-bottles-wonder.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
'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
3 changes: 2 additions & 1 deletion contracts/utils/cryptography/MessageHashUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ library MessageHashUtils {
* See {ECDSA-recover}.
*/
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));
}

/**
Expand Down

0 comments on commit d39df78

Please sign in to comment.