Created
August 9, 2022 07:13
-
-
Save ItsCuzzo/472db3ffba0bf1034bbaf642cac23123 to your computer and use it in GitHub Desktop.
Testing keccak in assembly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: UNLICENSED | |
pragma solidity 0.8.16; | |
contract KekTest { | |
/// 22578 | |
function regHash(uint256 a, uint256 b) external pure returns (bytes32) { | |
return keccak256(abi.encodePacked(a, b)); | |
} | |
/// 22160 | |
function asmHash(uint256 a, uint256 b) external pure returns (bytes32 _hash) { | |
assembly { | |
mstore(0x00, a) | |
mstore(0x20, b) | |
_hash := keccak256(0x00, 64) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment