コード例 #1
0
ファイル: affine.py プロジェクト: ziadab/classical_cipher
1-encrypt  \n2-decrtpt	""")
choise = input('Choise: ')
if choise == 1 or choise == '1':
    plaintext = str(input("\033[97mYour Secret Text :\033[91m "))
    words = plaintext.split(" ")
    key1 = int(
        input(
            "\033[97mchoise the first key ! like:[0,1,2,3,4,..] default=1 ! :\033[91m "
        ))
    key2 = int(
        input(
            "\033[97mchoise the first key ! like:[0,1,2,3,4,..] default=1 ! :\033[91m "
        ))
    i = 0
    for i in range(len(words)):
        cipher = Affine(a=key1, b=key2).encipher(words[i])
        cipher = cipher.lower()
        print(cipher, sep=' ', end=" ")
else:
    cipher = str(input("\033[97mYour Text : "))
    words = cipher.split(" ")
    key1 = int(input("\033[97mThe first key that you encrypt with :\033[91m "))
    key2 = int(
        input("\033[97mThe second key that you encrypt with :\033[91m "))
    i = 0
    for i in range(len(words)):
        plaintext = Affine(a=key1, b=key2).decipher(words[i])
        plaintext = plaintext.lower()
        print(plaintext, sep=' ', end=" ")

print("\033[0m ")
コード例 #2
0
ファイル: warmup.py プロジェクト: K4ds3/ctf-writeups
from pycipher import Affine

for i in range(1, 25):
    for i2 in range(0, 25):
        try:
            s = Affine(a=i, b=i2).decipher("myjd{ij_fkwizq}")
            if "actf" in s.lower():
                print(s)
        except Exception:
            pass