Created
August 18, 2020 00:06
-
-
Save clesaege/00cc08cc4ccd873fa60a19ffb30e2e9d 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.7.0; | |
contract Storing { | |
uint a; | |
uint b; | |
uint c; | |
uint d; | |
function store(uint _a, uint _b, uint _c, uint _d) public { | |
a=_a; | |
b=_b; | |
c=_c; | |
d=_d; | |
} | |
function compute() public view returns(uint e) { | |
return a+b+c+d; | |
} | |
} | |
contract Hashing{ | |
bytes32 hash; | |
function store(uint _a, uint _b, uint _c, uint _d) public { | |
hash=keccak256(abi.encodePacked(_a,_b,_c,_d)); | |
} | |
function compute(uint _a, uint _b, uint _c, uint _d) public view returns(uint e) { | |
require(keccak256(abi.encodePacked(_a,_b,_c,_d))==hash); | |
return _a+_b+_c+_d; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment