def decrypt(self, ciphertext):
    if (len(ciphertext) != self.block_size):
        raise ValueError(((('wrong block length, expected ' + str(self.block_size)) + ' got ') + str(len(ciphertext))))
    Kd = self.Kd
    BC = (self.block_size // 4)
    ROUNDS = (len(Kd) - 1)
    if (BC == 4):
        SC = 0
    elif (BC == 6):
        SC = 1
    else:
        SC = 2
    s1 = shifts[SC][1][1]
    s2 = shifts[SC][2][1]
    s3 = shifts[SC][3][1]
    a = ([0] * BC)
    t = ([0] * BC)
    for i in range(BC):
        t[i] = (((((ord(ciphertext[(i * 4)]) << 24) | (ord(ciphertext[((i * 4) + 1)]) << 16)) | (ord(ciphertext[((i * 4) + 2)]) << 8)) | ord(ciphertext[((i * 4) + 3)])) ^ Kd[0][i])
    for r in range(1, ROUNDS):
        for i in range(BC):
            a[i] = ((((T5[((t[i] >> 24) & 255)] ^ T6[((t[((i + s1) % BC)] >> 16) & 255)]) ^ T7[((t[((i + s2) % BC)] >> 8) & 255)]) ^ T8[(t[((i + s3) % BC)] & 255)]) ^ Kd[r][i])
        t = copy.copy(a)
    result = []
    for i in range(BC):
        tt = Kd[ROUNDS][i]
        result.append(((Si[((t[i] >> 24) & 255)] ^ (tt >> 24)) & 255))
        result.append(((Si[((t[((i + s1) % BC)] >> 16) & 255)] ^ (tt >> 16)) & 255))
        result.append(((Si[((t[((i + s2) % BC)] >> 8) & 255)] ^ (tt >> 8)) & 255))
        result.append(((Si[(t[((i + s3) % BC)] & 255)] ^ tt) & 255))
    return ''.join(map(chr, result))
def decrypt(self, ciphertext):
    if (len(ciphertext) != self.block_size):
        raise ValueError(((('wrong block length, expected ' + str(self.block_size)) + ' got ') + str(len(ciphertext))))
    Kd = self.Kd
    BC = (self.block_size // 4)
    ROUNDS = (len(Kd) - 1)
    if (BC == 4):
        SC = 0
    elif (BC == 6):
        SC = 1
    else:
        SC = 2
    s1 = shifts[SC][1][1]
    s2 = shifts[SC][2][1]
    s3 = shifts[SC][3][1]
    a = ([0] * BC)
    t = ([0] * BC)
    for i in range(BC):
        t[i] = (((((ord(ciphertext[(i * 4)]) << 24) | (ord(ciphertext[((i * 4) + 1)]) << 16)) | (ord(ciphertext[((i * 4) + 2)]) << 8)) | ord(ciphertext[((i * 4) + 3)])) ^ Kd[0][i])
    for r in range(1, ROUNDS):
        for i in range(BC):
            a[i] = ((((T5[((t[i] >> 24) & 255)] ^ T6[((t[((i + s1) % BC)] >> 16) & 255)]) ^ T7[((t[((i + s2) % BC)] >> 8) & 255)]) ^ T8[(t[((i + s3) % BC)] & 255)]) ^ Kd[r][i])
        t = copy.copy(a)
    result = []
    for i in range(BC):
        tt = Kd[ROUNDS][i]
        result.append(((Si[((t[i] >> 24) & 255)] ^ (tt >> 24)) & 255))
        result.append(((Si[((t[((i + s1) % BC)] >> 16) & 255)] ^ (tt >> 16)) & 255))
        result.append(((Si[((t[((i + s2) % BC)] >> 8) & 255)] ^ (tt >> 8)) & 255))
        result.append(((Si[(t[((i + s3) % BC)] & 255)] ^ tt) & 255))
    return .join(map(chr, result))