Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save taijusanagi/1cf345cca91903ebebfe6a33cfc77d9f to your computer and use it in GitHub Desktop.
Save taijusanagi/1cf345cca91903ebebfe6a33cfc77d9f to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.0+commit.c7dfd78e.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract CompateAbiEncodePackedAndBytes {
function execute1() public {
require(test1());
}
function execute2() public {
require(test2());
}
function test1() public pure returns (bool) {
return keccak256(abi.encodePacked("string")) == keccak256(abi.encodePacked("string"));
}
function test2() public pure returns (bool) {
return keccak256(bytes("string")) == keccak256(bytes("string"));
}
}
@taijusanagi
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment