import pyautogui # Enter password window import hashlib # Create hash of the key import tkinter #tkinter from tkinter import filedialog from . import Crypter # Create process run def Run(): # Step 1 - select folder to crypt lStep_1_TkinterRoot = tkinter.Tk() lStep_1_TkinterRoot.withdraw() #lStep_1_FolderPath = filedialog.askdirectory(parent=lStep_1_TkinterRoot,title='Please select a source code directory to crypt') # Step 2 - set password to crypt lKeyHashStr_1 = hashlib.sha256(pyautogui.password('Please enter the key to protect source code').encode("utf-8")).digest() print(lKeyHashStr_1) lKeyHashStr_2 = hashlib.sha256(pyautogui.password('Please repeat the key to protect source code').encode("utf-8")).digest() print(lKeyHashStr_2) if lKeyHashStr_1 == lKeyHashStr_2: print("Passed - do AES encryption") from Crypto.Cipher import AES #Crypter.encrypt_file(lKeyHashStr_1, "c:\\test.png", "c:\\test.enc") Crypter.decrypt_file(lKeyHashStr_1, "c:\\test.enc", "c:\\testEnc2.png") #IV = 16 * '\x00' # Вектор инициализации: обсуждается позже #mode = AES.MODE_CBC #encryptor = AES.new(lKeyHashStr_1, mode, IV=IV) #text = "Text to be crypted!" #ciphertext = encryptor.encrypt(text)