def fnv1_hash(somestr):
    """
    Translated to python from src/util/Hash.h -- note that this
    hash function is broken so we cannot use the fnvHash python library,
    since persistent data used this hash function.
    """
    fnvprime = 16777619
    fnvsize = 2 ** 32
    hval = 0
    for byte in somestr:
        hval = fnvprime * hval % fnvsize
        hval ^= byte & 255
    return hval
