generated from PaulRBerg/hardhat-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Fanghao Yang
committed
Dec 1, 2023
1 parent
08c314e
commit 000fc89
Showing
15 changed files
with
841 additions
and
118 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.15; | ||
|
||
import { Sha2Ext } from "./lib/Sha2Ext.sol"; | ||
import { LibBytes } from "./lib/LibBytes.sol"; | ||
|
||
contract TestSha2 { | ||
// modify the storage of the contract so that the gas cost of the test is measured. | ||
bool public success; | ||
|
||
function sha384External(bytes calldata _data) public pure returns (bytes32, bytes16) { | ||
bytes32 b1; | ||
bytes16 b2; | ||
(b1, b2) = Sha2Ext.sha384(_data); | ||
return (b1, b2); | ||
} | ||
|
||
function sha384Gas(bytes calldata _data) external returns (bytes32, bytes16) { | ||
bytes32 b1; | ||
bytes16 b2; | ||
(b1, b2) = Sha2Ext.sha384(_data); | ||
success = true; | ||
return (b1, b2); | ||
} | ||
|
||
function sha256Gas(bytes calldata _data) external returns (bytes32) { | ||
bytes32 b1; | ||
b1 = sha256(_data); | ||
success = true; | ||
return (b1); | ||
} | ||
} |
Oops, something went wrong.