6 from typing
import List
12 DEFAULT_IV_UINT256 = \
13 13196537064117388418196223856311987714388543839552400408340921397545324034315
18 Note that this is currently experimental code. Hash a series of field
19 elements via the Merkle-Damgard construction on a MiMC compression
20 function. Note that since this function only accepts whole numbers of
21 scalar field elements, there is no ambiguity w.r.t to padding and we could
22 technically omit the finalization step. It has been kept for now, to allow
23 time for further consideration, and in case the form of the hasher changes
24 (e.g. in case we want to be able to hash arbitrary bit strings in the
27 def __init__(self, compression_fn: MiMCBase, iv: int = DEFAULT_IV_UINT256):
28 assert compression_fn.prime < (2 << 256)
30 self.
_iv = iv % compression_fn.prime
32 def hash(self, values: List[int]) -> int: