Package: easySED
Easy Secure Encryptor Decryptor moduleThis module to used to add military level encryption system to your project , encrypt strings , files and even whole directories etc"Main Users :
Hunders of security oriented applicationsinstall module using pip commandpipinstalleasySEDBefore you start - it is important that you note the version of this module before installing as sometimes the core method which are outsourced may get updated in pythons next version and make your encrypted file absolite , you remember the version so that you can install that version and prevent the data lossThis module is used for encryting and decrypting things in the easy sqlite module alsoTo import in project -fromeasySEDimportSEDThen make a object instance of ED classobj=SED.ED()How this algorithm worksTakes your password and convert to the SHA256 encrypted hash form , this hash form is further rearranged into a diff string by using the values provided in the pin , if the pin is not provided then 123456 is used by defaultSo now  [ password ] -> [ SHA256 (password) ] -> [ PIN (SHA256 (password)) ] or let say this as XNow we generate a random 44 digit string say Y and encrypt this key using onetimepad encryption tech with key = X and lets say this becomes Anow We encypt the actaul string with the Y using pythons cryptoraphy fernet tech and lets say this becomes Znow we combine A and Z and output itHow secure is thisThis algo combines the three of most secure encryption techniques in the world which includes SHA256 , onetimepad , cryptography fernet tech .So any string encrypted using this algo must be unbreakable by any super computer at least in a persons lifetime .But to be on the safe side, it is recommended that you at least 12 digit password containing all lower case , upper case , numbers and special chars as well . Also he password should be guessable i.e it should not be relatable with you daily habits etcAlso you can use pin for security which is set to 123456 by defaultAlso if encypting the same string again yields diff result , so no one can even map the result outcomesMethods -Set the password and (Optional - pin)obj.setPassword_Pin(password,pin=123456)Pin can be of max 6 digits.It is recommend that you use at least a 12 digit password containing all lower case , upper case , nums , special char for better securityTo check if the level of password matches your requirements use this methodobj.checkPass(passwordInput,minLength=8,lowerCase=True,upperCase=True,nums=True,specialChar=True)Above method will return True or False according to level matches or not
EX - You can make any of the specialChar = False if you think that is not necessary in your passwordIt recommend that you deallocate the password from your script by using del operator , As the password is securely stored in the obj of this moduleStore the password + pin (123456 by default) in the encrypted form for further authentication stuffAs you see that string encrypted using this module is different each time , you if you large amounts of data to be decryted and encrypted like when encrypting dirs or data base , then it is better to store a reference password so that the module and check whether the password provided at the time of decryption is same by which the data was encryptedPassword is encrypted using SHA512 , SHA256 , stringSalting combined togetherso no one can guess the actual password by looking as the referenced passwordpassYouCanStore=obj.returnEncryptedPassword(password)now you can store this encrypted string any where and then pass this string in below method to authenticateAuthenticate the input password and pin (123456 by default if not provided) using previously stored passwordisCorrect=obj.authenticatePassword(storedPass,passwordInput,pinInput=123456)This function returns True or False depending on if the password + pin input matches the stored password + pinencrypting string data typesafter setting the password call this method and pass on the string to be encrypted hereencrypted_string=obj.encrypter(passStringHere)this is going to diff next time even if you set the same stuff , which gives it a unbreable securitydecrypting string data typesafter setting the password call this method and pass on the ecnrypted string heredecrypted_string=obj.decrypter(passStringHere)encrypting fileafter setting the password call this method and pass the file path here which is going to be encryptedHere the crypto fernet encryption technique is used to encrypt the bytes data of the fileforiinobj.encryptFile(path_to_file,path_to_destination):passpath to destination is the folder path were the encrypted file is going to be storedfunction is set to yield the status update while running so you require a loop to run the methodi will be reveice the status codes of the method which can be used to make loading bars for large files0 represent that the file is successfully opened for encryption1 represent that the key is generated suucessfully2 represent that the file is been encrypted3 represent that the encrypted file is been written suucessfullydecrypting fileafter setting the password call this method and pass the encrypted file path here which is going to be decryptedforiinobj.decryptFile(path_to_encrypted_file,path_to_destination):passpath to destination is the folder path were the decrypted file is going to be storedfunction is set to yield the status update while running so you require a loop to run the methodi will be reveice the status codes of the method which can be used to make loading bars for large files0 represent that the file is successfully opened for decryption1 represent that the key is readed suucessfully2 represent that the file is been decrypted3 represent that the decrypted file is been written suucessfullyIt will raise a RuntimeError("password / pin does not match ... ") if the password and pin entered are incorrectsometimes - one in thousands you can face this error even if you enter the exact password , then you should try again and error should be resolvedencrypting directioriesafter setting the password call this method and pass the dir path here which is going to be encryptedthis method encrytes every file inside the dir recursively that is files inside sub folder are also taken into considerationforiinobj.encryptDir(path_to_dir,path_to_destination):passpath to destination is the folder path were the encrypted directory is going to be storedfunction is set to yield the status update while running so you require a loop to run the methodi will be reveice the status codes of the method which can be used to make loading bars for large dirsfirst the total no of files will be yield and then after one file is encrypted it will yield how many files are left till no file is leftnote - please do not store any other file in this folder as then the decryption will be possibleencrypting directioriesafter setting the password call this method and pass the dir path here which is going to be encryptedNote - any other file found other than the files encrypted using this module will result in hault of the decryption processforiinobj.decryptDir(path_to_encryptedDir,path_to_destination):passpath to destination is the folder path were the decrypted directory is going to be storedit will be same as the dir which is used to make the encrypted dir just hidden folder will now be visible , you have to make them hidden again if you wantfunction is set to yield the status update while running so you require a loop to run the methodi will be reveice the status codes of the method which can be used to make loading bars for large dirsfirst the total no of files will be yield and then after one file is decrypted it will yield how many files are left till no file is leftmaking things more secureIt is recommend that follow these steps for a unbreakable encrytionset a password with at least 12 characters containing all lower case , upper case , numbers , special characters etcset a 6 digit pin (passed into password set function)you non guessable passwords i.e password does not reflect your daily habits etcSample program 1 for string data types -fromeasySEDimportSEDe=SED.ED()e.setPassword_Pin("#123hello","236598")encoded=e.encrypter("hello world , my name is harsh native and I love programming")print("encypted string = ",encoded)decoded=e.decrypter(encoded)print("\ndecrypted string = ",decoded)# password you can store for further authenticationobjStore=e.returnPassForStoring()print("\npassword you can store for further authentication = ",objStore)if(e.authenticatePassword(objStore,"#123hello","236598")):print("\nyou are rigth user")if(e.authenticatePassword(objStore,"#123world","236598")):print("\nshould not be here")else:print("\nwrong user")# output on run 1 -# encypted string =  78785041096701754b4b4364653222732a31557d503024721f552a7204795b1f457d5f0b41796d1d746c7c05gAAAAABfgZ9pXArC7XWbDmqUErbVR0h2uJT0_cXOgrdg0SCb6ZbcYpQAmjIzrk0b9pau6_mbuxR0CA_x2rGE6UpQ1Zcu_lvvxToI4AXCR0BjY9HzRiEsMW6NXMyVy7Pw3Korf8HmInUhTnzc_QjLnlm8LBVVwjloow==# decrypted string =  hello world , my name is harsh native and I love programming# password you can store for further authentication =  e6095d7d7d130f53d02841f606e0526dbac9c8a41f5dfd8ea7c8fa295cd7a8cb271c999cb878551e66b367948fadca1d7e0493609b419f5715dcfa9c69b0f847# you are rigth user# wrong user# output on run 2 -# encypted string =  6a6556710e6602615b1f6958622a2d42080214077d312a7c2c062b41737909080254622054686d1c79616405gAAAAABfgZ-P_6PKpmfZGxTeO32_toMUOrQ1tdiR34JNTgGgVA2ydp8P1g31ZLg73KfsI1DDQUoDJb15V9lzLkwjrw_-RhKWbOk_Z78ElCh5yWp5-csPIHslZZ4bcFKlE-vErSCXHDuo5jxeJO529P5kC1i2o1O8Xg==# decrypted string =  hello world , my name is harsh native and I love programming# password you can store for further authentication =  e6095d7d7d130f53d02841f606e0526dbac9c8a41f5dfd8ea7c8fa295cd7a8cb271c999cb878551e66b367948fadca1d7e0493609b419f5715dcfa9c69b0f847# you are rigth user# wrong user# As you can see in output , both time the encrypted string is diffSample program 1 for file -fromeasySEDimportSEDe=SED.ED()e.setPassword_Pin("#123hello","236598")foriine.encryptFile(r"Z:\docx\python.docx",r"C:\Users\harsh\Desktop"):passforiine.decryptFile(r"C:\Users\harsh\Desktop\python.docx__enc",r"C:\Users\harsh\Desktop"):passSample program 1 for file -fromeasySEDimportSEDe=SED.ED()e.setPassword_Pin("#123hello","236598")foriine.encryptDir(r"Z:\docx",r"C:\Users\harsh\Desktop\hello"):print(i)foriine.decryptDir(r"C:\Users\harsh\Desktop\hello",r"C:\Users\harsh\Desktop\hello2"):print(i)Contibute & report bugs  -Post any issues on githubCheck out code on github