def fletcher(barray):
    """Return the two Fletcher-16 sums of a byte array."""
    assert isinstance(barray, bytes) or isinstance(barray, bytearray)
    a = 0
    b = 0
    for c in barray:
        a = (a + c) % 255
        b = (a + b) % 255
    return (a, b)