mirror of
https://github.com/tornadocash/tornado-core.git
synced 2025-08-06 05:44:16 -04:00
rename mimc mentions to a generic hasher
This commit is contained in:
parent
6b067f067f
commit
71b767ade1
6 changed files with 28 additions and 28 deletions
|
@ -11,7 +11,7 @@
|
|||
|
||||
pragma solidity ^0.5.8;
|
||||
|
||||
library MiMC {
|
||||
library Hasher {
|
||||
function MiMCSponge(uint256 in_xL, uint256 in_xR, uint256 in_k) public pure returns (uint256 xL, uint256 xR);
|
||||
}
|
||||
|
||||
|
@ -42,18 +42,18 @@ contract MerkleTreeWithHistory {
|
|||
_roots[0] = hashLeftRight(_zeros[levels - 1], _zeros[levels - 1]);
|
||||
}
|
||||
|
||||
function hashLeftRight(uint256 left, uint256 right) public pure returns (uint256 mimc_hash) {
|
||||
function hashLeftRight(uint256 left, uint256 right) public pure returns (uint256 hash) {
|
||||
uint256 k = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
|
||||
uint256 R = 0;
|
||||
uint256 C = 0;
|
||||
|
||||
R = addmod(R, left, k);
|
||||
(R, C) = MiMC.MiMCSponge(R, C, 0);
|
||||
(R, C) = Hasher.MiMCSponge(R, C, 0);
|
||||
|
||||
R = addmod(R, right, k);
|
||||
(R, C) = MiMC.MiMCSponge(R, C, 0);
|
||||
(R, C) = Hasher.MiMCSponge(R, C, 0);
|
||||
|
||||
mimc_hash = R;
|
||||
hash = R;
|
||||
}
|
||||
|
||||
function _insert(uint256 leaf) internal {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue