Implement MerkleCRH

This commit is contained in:
Jack Grigg 2018-05-18 13:01:01 +12:00
parent 929b36ccfd
commit 3e2b2ab8f8
1 changed files with 9 additions and 0 deletions

9
sapling_merkle_tree.py Normal file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env python3
from sapling_pedersen import pedersen_hash
from sapling_utils import i2lebsp
MERKLE_DEPTH = 32
def merkle_crh(layer, left, right):
l = i2lebsp(6, MERKLE_DEPTH - 1 - layer)
return pedersen_hash(b'Zcash_PH', l + left + right)