Пример #1
0
from Crypto.Cipher import AES
from src.dictionary import Dictionary
from time import time

current_time_ms = lambda: int(round(time() * 1000))

d = Dictionary()
mode = input(
    "select mode e (encrypt), r (encrypt with random key), d (decrypt) or c (crack)?: \n"
)

key_string = ""
if mode == "e" or mode == "d":
    key_string = input("enter key: \n")
elif mode == "r":
    key_string = d.random_word()
    print(f"{key_string} was chosen as the random key")
    numbers = input("salt key (y / n)?\n")
    if numbers == "y":
        key_string = key_string.replace("o", "0")
        key_string = key_string.replace("i", "1")
        key_string = key_string.replace("e", "3")
        key_string = key_string.replace("s", "5")
        print(f"key looks now like this: {key_string}")
    mode = "e"
elif mode == "c":
    print("craking mode selected, no key input is required")

while len(key_string) % 16 != 0:
    key_string += " "