Created
March 16, 2022 15:31
-
-
Save Aboudjem/7ef81d0c8d44f98e785d34b77da17f4a to your computer and use it in GitHub Desktop.
Test Keccak256 with string and bytes32
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.12; | |
contract Test { | |
function getBytes32() external pure returns (bytes32, bytes32) { | |
bytes32 withString = keccak256(abi.encode("0x0000000000000000000000000000000000000000000000000000000000000001")); | |
bytes32 withBytes32 = keccak256(abi.encode(0x0000000000000000000000000000000000000000000000000000000000000001)); | |
return (withString, withBytes32); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment