Last active
November 24, 2022 15:52
-
-
Save frangio/924b4becc8779fb3f5ce9fab39135a07 to your computer and use it in GitHub Desktop.
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
pragma solidity ^0.8.0; | |
function keccak256_2(bytes memory data) external pure returns (bytes32) { | |
bytes32 h1 = keccak256(data); | |
bytes32 h2; | |
/// @solidity memory-safe-assembly | |
assembly { | |
mstore(0, h1) | |
h2 := keccak256(0, 32) | |
} | |
return h2; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment