def weakchecksum(data):
    """
    Generates a weak checksum from an iterable set of bytes.
    """
    a = b = 0
    l = len(data)
    for i in range(l):
        a += data[i]
        b += (l - i)*data[i]

    return (b << 16) | a, a, b

    Generates a weak checksum from an iterable set of bytes.
    
recipes/Python/577518_Rsync_Algorithm/recipe-577518.py