Add Bytes32x2Set (#5442)
Co-authored-by: Ernesto García <ernestognw@gmail.com>
This commit is contained in:
@ -15,13 +15,13 @@ library Hashes {
|
||||
* NOTE: Equivalent to the `standardNodeHash` in our https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
|
||||
*/
|
||||
function commutativeKeccak256(bytes32 a, bytes32 b) internal pure returns (bytes32) {
|
||||
return a < b ? _efficientKeccak256(a, b) : _efficientKeccak256(b, a);
|
||||
return a < b ? efficientKeccak256(a, b) : efficientKeccak256(b, a);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory.
|
||||
*/
|
||||
function _efficientKeccak256(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
|
||||
function efficientKeccak256(bytes32 a, bytes32 b) internal pure returns (bytes32 value) {
|
||||
assembly ("memory-safe") {
|
||||
mstore(0x00, a)
|
||||
mstore(0x20, b)
|
||||
|
||||
Reference in New Issue
Block a user