def unmask_buff(buff):
    """
    unmask buff, using the firsts 4 bytes as the mask
    """
    buff = bytearray(buff)
    mask = buff[:4]
    return bytes(bytearray(x ^ mask[i % 4] for i, x in enumerate(buff[4:])))