3
Contributors
4
Replies
126
Views
4 Years
Discussion Span
Last Post by vegaseat
0

Here is a math 'black box' that you can use

from nzmath.gcd import extgcd
from nzmath.matrix import Matrix

def decrypt_key(cyph, uncyph, nletter):
    A = Matrix(2, 2, list(cyph))
    D = A.determinant()
    u, v, d = extgcd(D, nletter)
    if d != 1:
        raise RuntimeError("Can not compute key matrix")
    B = (Matrix(2, 2, list(uncyph)) * A.adjugateMatrix() * u) % nletter
    x, y = B.compo
    return tuple(x + y)

if __name__ == '__main__':
    print(decrypt_key((15, 12, 2, 19), (5, 7, 19, 4), 26))

"""my output -->
(3L, 19L, 15L, 14L)
"""

install module nzmath from pypi.

0

hi mod i am not able to chat with u as i m new can u pls tell whr we can chat like gtalk or skype
i have still queries in it
i have with me encrypted text as well as charset but i dont got the key
also my matrix is 3x3

Edited by cdwin: edit

1

Please avoid SMS language in the forum ...

The best thing to do is to post your attempts to decipher your text with python in this thread. We may be able to help you but nobody will write the code for you.

Edited by Gribouillis

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.