def decrypt_text_file(encrypt_file, save_file): encrypt_bytes = read(encrypt_file) key = find_key_for_text(encrypt_bytes) if key != -1: write(save_file, decrypt_data(encrypt_bytes, key)) else: print('We could not find a key :(')
def decrypt_file_example(encrypt_txt, decrypt_txt, key): encrypt_bytes = read(encrypt_txt) print('encrypt_data=', encrypt_bytes) decrypt_bytes = decrypt_data(encrypt_bytes, key) print('decrypt_data=', decrypt_bytes) print('decrypt_text=', transform_code_to_text(decrypt_bytes)) write(decrypt_txt, decrypt_bytes)
def encrypt_file_example(file, encrypt_txt, key): source_text = read(file) print('source_byte=', source_text[0:15]) # text = transform_to_text(source_text) text = transform_code_to_text(source_text) print('source_text=', text) encrypt_text = encrypt_data(source_text, key) print('encrypt_byte=', encrypt_text[0:15]) print('encrypt_text=', transform_code_to_text(encrypt_text)) write(encrypt_txt, encrypt_text)
def encrypt_file_after_n_bytes(file, encrypt_txt, key=231, n=50): source_bytes = read(file) encrypt_bytes = encrypt_data(source_bytes[n:], key) write(encrypt_txt, source_bytes[0:n] + encrypt_bytes)
def decrypt(file_name, write_file): data = read(file_name) decrypt_data = decrypt_bytes(data) write(write_file, decrypt_data)
def decrypt(a, b): bytes = read(FILE_TASK_4)