zcash-test-vectors/sapling_merkle_tree.py

10 lines
257 B
Python
Raw Normal View History

2018-05-17 18:01:01 -07:00
#!/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)