From 24a2a0ae0c6fc7fa54df3700903f4172ff6a4810 Mon Sep 17 00:00:00 2001 From: BreizhHardware Date: Sun, 27 Mar 2022 14:01:22 +0200 Subject: [PATCH] End of the project --- __pycache__/crypt_and_decrypt.cpython-38.pyc | Bin 2201 -> 2201 bytes __pycache__/crypt_and_decrypt.cpython-39.pyc | Bin 0 -> 2196 bytes __pycache__/find_key.cpython-38.pyc | Bin 2599 -> 2599 bytes __pycache__/find_key.cpython-39.pyc | Bin 0 -> 2572 bytes crypt_and_decrypt.py | 2 ++ find_key.py | 3 +++ jeudetest.py | 18 ++++++++++-------- jeudetestdemo.py | 7 +++++++ 8 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 __pycache__/crypt_and_decrypt.cpython-39.pyc create mode 100644 __pycache__/find_key.cpython-39.pyc create mode 100644 jeudetestdemo.py diff --git a/__pycache__/crypt_and_decrypt.cpython-38.pyc b/__pycache__/crypt_and_decrypt.cpython-38.pyc index 3fbbd00d5edec9f3b3c0043f192561c9f2fb6f41..285b7afceca43d6ccb33df03a66050f2f72987ca 100644 GIT binary patch delta 48 zcmbO!I8%@}l$V!_0SJVyTO{>t7g$MyElpsY!0X2sTD=4fz<7BC`c4o(E zQms$P5s81Ghvb;QBPafaxpK;x8z;UuTh~ddO6iGN?VGpr!btvmS(El1cu|lb-YsMT5(0iYZTd7!95Y8OqXO(D0R@F(qUfV`H*{ zm4O_W6Nju3UYMJdQ`Ve_Dr z@jk$tJ%o6=Xjl$654=Bb4|vXxxb%)WXOEcl1rzMR=Pa#$!m@?CjJxL-$VV)#31+z<}SEN`DMJqGRHds| zN=+2E+exa{TYA4|HsVxnNagg8d;7N1(keEJ%#*>)G3tAKf-m6J<8%n1%laKt7q&8l zb2+u*vD%NFY-$3sB_M_k>A;A7hwN`qfUAE1Bn>a{9SCT?^bWj1kc%TE#W5d*c__tW zU$5lBk#9sE<~;WfFvHns&CdJKgJa;1Rj!u-a1Q%F;+SZu1-v2|rx}1QsQ;;N7G8WT zr;&^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BRwB;IzD= zR@yNOBS9Sb;4c{4DDezdl;Y?B3YwPZ7& u2sL#GcHS=hjLL`Gbm9^&LmXMwR`(O#@0c}0LQ2uEiP`zt3v+X`&Hn(TCuGq8 literal 0 HcmV?d00001 diff --git a/crypt_and_decrypt.py b/crypt_and_decrypt.py index 87f315f..bde1dfb 100644 --- a/crypt_and_decrypt.py +++ b/crypt_and_decrypt.py @@ -32,6 +32,7 @@ def chiffrementAffineByte(data: bytes, keya: int, keyb: int) -> bytes: y = (keya*x+keyb)%256 return bytes([alphabet[y]]) + def inverse(a): """ Renvoie l'inverse du module de a et x par 256 """ @@ -40,6 +41,7 @@ def inverse(a): x += 1 return x + def dechiffrementAffineByte(data: bytes, keya: int, keyb: int) -> bytes: """ Renvoie le byte data décrypté avec le chiffrement affine """ diff --git a/find_key.py b/find_key.py index b9df4b0..a36e9e2 100644 --- a/find_key.py +++ b/find_key.py @@ -55,6 +55,7 @@ def findKeywrite(data: bytes, dataout: bytes, filenameOut = 'result'): fdout.write(str(keyb)) fdout.write("\n") + def findKeyList(data: bytes, dataout: bytes): """Renvoie la liste des couples de clé possible pour que data soit égale à dataout. """ @@ -68,6 +69,7 @@ def findKeyList(data: bytes, dataout: bytes): L.append(t) return L + def comparKey(L: list, M: list) -> tuple: """Compare les couples de clé valeur et renvoie le couple commun aux 2 listes M et L. """ @@ -75,3 +77,4 @@ def comparKey(L: list, M: list) -> tuple: for y in range(len(M)): if L[i] == M[y]: return L[i] + \ No newline at end of file diff --git a/jeudetest.py b/jeudetest.py index a7ed512..c15d906 100644 --- a/jeudetest.py +++ b/jeudetest.py @@ -3,19 +3,21 @@ from find_key import * -#print(sortbyteFreq(byteFreq("data"))) -#findKeywrite(b'\xaa', b'\x20', "keyoutspace") -#findKeywrite(b'\x31', b'\x65', "keyoute") +print(sortbyteFreq(byteFreq("data"))) +findKeywrite(b'\xaa', b'\x20', "keyoutspace") +findKeywrite(b'\x31', b'\x65', "keyoute") #print(findKeyList(b'\xaa', b'\x20')) -#print(comparKey(findKeyList(b'\xaa', b'\x20'), findKeyList(b'\x31', b'\x65'))) +print(comparKey(findKeyList(b'\xaa', b'\x20'), findKeyList(b'\x31', b'\x65'))) #cryptByteFile('tescrypt.txt', 1, 3, "resulttest2") #cryptByteFile('data', 1, 3, 'resultcryptdata') #cryptByteFile('monkey.jpg', 1, 3) #decryptByteFile('resulttest2', 1, 3, "decryptresult2") #decryptByteFile('resultcryptdata', 1, 3, 'resultdecryptdata') -decryptByteFile('data', - comparKey(findKeyList(b'\xaa', b'\x20'), findKeyList(b'\x31', b'\x65'))[0], - comparKey(findKeyList(b'\xaa', b'\x20'), findKeyList(b'\x31', b'\x65'))[1], - "dataDecrypted") +#decryptByteFile('data', +# comparKey(findKeyList(b'\xaa', b'\x20'), findKeyList(b'\x31', b'\x65'))[0], +# comparKey(findKeyList(b'\xaa', b'\x20'), findKeyList(b'\x31', b'\x65'))[1], +# "dataDecrypted") #cryptByteFile('enemy-from-the-series-arcane-league-of-legends.mp3', 45, 76, 'enemyCrypted') #decryptByteFile('enemyCrypted', 45, 76, 'enemyDeCyted.mp3') +cryptByteFile('../enemy-from-the-series-arcane-league-of-legends.mp3', 45, 85, '../enemyCrypted') +decryptByteFile('../enemyCrypted', 45, 85, '../enemyDeCrypted') \ No newline at end of file diff --git a/jeudetestdemo.py b/jeudetestdemo.py new file mode 100644 index 0000000..3b1324b --- /dev/null +++ b/jeudetestdemo.py @@ -0,0 +1,7 @@ +from crypt_and_decrypt import * +from find_key import * + +cryptByteFile('../demo.mp3', 45, 85, '../demoCrypted.mp3') +print('Crypted') +decryptByteFile('../demoCrypted.mp3', 45, 85, '../demoDeCrypted.mp3') +print('Decrypted') \ No newline at end of file