(ct, key, symbols="ABCDEFGHIJKLMNOPQRSTUVWXYZ")
return "".join([A[i % N] for i in P])
Deciphering is the same as enciphering but using the inverse of the key matrix.

    Examples
    ========

    >>> from sympy.crypto.crypto import decipher_hill
    >>> from sympy import Matrix
    >>> ct = "UEQDUEODOCTCWQ"
    >>> key = Matrix([[1, 2], [3, 5]])
    >>> decipher_hill(ct, key)
    'MEETMEONMONDAY'
    >>> ct = "UEQDUEODHBOYDJYU"
    >>> decipher_hill(ct, key)
    'MEETMEONTUESDAYA'
Deciphering is the same as enciphering but using the inverse of the key matrix.
Deciphering is the same as enciphering but using the inverse of the key matrix .
def decipher_hill(ct, key, symbols="ABCDEFGHIJKLMNOPQRSTUVWXYZ"):
    """
    Deciphering is the same as enciphering but using the inverse of the key matrix.

    Examples
    ========

    >>> from sympy.crypto.crypto import decipher_hill
    >>> from sympy import Matrix
    >>> ct = "UEQDUEODOCTCWQ"
    >>> key = Matrix([[1, 2], [3, 5]])
    >>> decipher_hill(ct, key)
    'MEETMEONMONDAY'
    >>> ct = "UEQDUEODHBOYDJYU"
    >>> decipher_hill(ct, key)
    'MEETMEONTUESDAYA'

    """
    symbols = "".join(symbols)
    A = alphabet_of_cipher(symbols)
    N = len(A)   # normally, 26
    k = key.cols
    ct0 = [x.capitalize() for x in ct if x.isalnum()]
    C = [A.index(x) for x in ct0]
    n = len(C)
    m = n//k
    if n > m*k:
        C = C + [0]*(n - m*k)
        m = m + 1
    key_inv = key.inv_mod(N)
    P = [list(key_inv*Matrix(k, 1, [C[i] for i in range(k*j, k*(j + 1))])) for j in range(m)]
    P = flatten(P)
    return "".join([A[i % N] for i in P])
def decipher_hill ( ct , key , symbols = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) : symbols = "" . join ( symbols ) A = alphabet_of_cipher ( symbols ) N = len ( A ) # normally, 26 k = key . cols ct0 = [ x . capitalize ( ) for x in ct if x . isalnum ( ) ] C = [ A . index ( x ) for x in ct0 ] n = len ( C ) m = n // k if n > m * k : C = C + [ 0 ] * ( n - m * k ) m = m + 1 key_inv = key . inv_mod ( N ) P = [ list ( key_inv * Matrix ( k , 1 , [ C [ i ] for i in range ( k * j , k * ( j + 1 ) ) ] ) ) for j in range ( m ) ] P = flatten ( P ) return "" . join ( [ A [ i % N ] for i in P ] )