Beispiel #1
0
        res.append(chr(i))
    return res


if __name__ == '__main__':
    while True:
        print_aes_menu()
        choice = int(input())
        if choice == 1:
            aes = AES(128)
            print_menu()
            choice = int(input())
            if choice == 1:
                symbols_str = str(input("Введите строку: "))
                symbols = str_to_ascii(symbols_str)
                encode = aes.encrypt_str(symbols)
                encode_str = ascii_to_str(encode)
                print(
                    f"Строка \'{symbols_str}\' перекодирована в \'{encode_str}\'"
                )

                decode = aes.decrypt_str(encode)
                decode_str = ascii_to_str(decode)
                print(
                    f"Строка \'{encode_str}\' расшифрована в \'{decode_str}\'")
            elif choice == 2:
                load_file = str(input("Ввведите имя файла: "))
                symbols = get_symbols_from_file(load_file)
                encode = aes.encrypt_str(symbols)

                encode_file = str(