Skip to content

ISCC - Winner Takes All Hash#

alg_wtahash(vec: Sequence[float], bits: Sequence[float]) -> bytes #

Calculate WTA Hash for vector with 380 values (MP7 frame signature).

Source code in iscc_core\wtahash.py
def alg_wtahash(vec: Sequence[float], bits) -> bytes:
    """Calculate WTA Hash for vector with 380 values (MP7 frame signature)."""
    h = []
    for perm in WTA_VIDEO_ID_PERMUTATIONS:
        v = vec[perm[0]], vec[perm[1]]
        h.append(v.index(max(v)))
        if len(h) == bits:
            break
    h = bitarray(h).tobytes()
    return h