def sqlite_byte_hamming_distance(a: str, b: str) -> int:
    """Calculate the Hamming distance between two strings."""
    diff = 0
    if len(a) < len(b):
        diff = len(b) - len(a)
        b = b[: len(a)]
    elif len(b) < len(a):
        diff = len(a) - len(b)
        a = a[: len(b)]
    return diff + sum(c1 != c2 for c1, c2 in zip(a, b))
Calculate the Hamming distance between two strings.
src/datachain/sql/sqlite/base.py