mpacts.tools. arrayhash

In order to be able to use this module import it like this:

import mpacts.tools.arrayhash
#or assign it to a shorter name
import mpacts.tools.arrayhash as arr
mpacts.tools.arrayhash.check_and_document_hash(tree, reference, **kwargs)
mpacts.tools.arrayhash.hash_array(array, hashfunc=<built-in function openssl_md5>, truncate=-1, tolerance=0, mask=None)
mpacts.tools.arrayhash.hash_tree(tree, hashfunc=<built-in function openssl_md5>, truncate=-1)

Provide a ‘hash’ that is unique to the given ‘state’ of (all) arrays in a simulation tree.

Parameters:
  • tree (mpacts.core.simulation.Simulation) – An mpacts simulation tree, or any sub-element that has for_each_child_recursive()
  • hashfunc – A standard library hash function. Default: hashlib:md5()
  • truncate (int) – If > 0, will return the resulting hash string up to the given value
mpacts.tools.arrayhash.verify_hash(tree, reference, **kwargs)