Skip to content

Commit

Permalink
Optimize Strings equal
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeSandwich authored May 18, 2023
1 parent 96b9559 commit d3b77cf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion contracts/utils/Strings.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ library Strings {
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
}
}

0 comments on commit d3b77cf

Please sign in to comment.