def Pinv(data, length):
    for i in range((length // 8)):
        bits = []
        for j in range(8):
            bits += [((data[((i * 8) + j)] >> k) & 1) for k in range(8)]
        FYinv(bits)
        for j in range(8):
            c = 0
            for k in range(8):
                c |= (bits[((j * 8) + k)] << k)
            data[((i * 8) + j)] = c
def Pinv(data, length):
    for i in range((length // 8)):
        bits = []
        for j in range(8):
            bits += [((data[((i * 8) + j)] >> k) & 1) for k in range(8)]
        FYinv(bits)
        for j in range(8):
            c = 0
            for k in range(8):
                c |= (bits[((j * 8) + k)] << k)
            data[((i * 8) + j)] = c