rename mimc mentions to a generic hasher

This commit is contained in:
poma 2019-10-04 15:12:22 +03:00
parent 6b067f067f
commit 71b767ade1
6 changed files with 28 additions and 28 deletions

View file

@ -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 {