diff --git a/enrocrypt/core.py b/enrocrypt/core.py index 1f3f8c9..9e14817 100644 --- a/enrocrypt/core.py +++ b/enrocrypt/core.py @@ -1,7 +1,7 @@ from typing import Any -from hashing import Hashing -from encryption import Encryption -from basic import Basic +from enrocrypt.hashing import Hashing +from enrocrypt.encryption import Encryption +from enrocrypt.basic import Basic class Core(Hashing,Encryption,Basic): '''Given Below Is The Syntax To Set Configurations For This Class. This Must Be Used As Is(Just Change The File Path) @@ -33,4 +33,3 @@ def get_hash_object(self): hashing = Hashing() hashing(bytes(self.salt.encode())) return hashing - \ No newline at end of file diff --git a/enrocrypt/encryption.py b/enrocrypt/encryption.py index 7c09ef1..a7a749b 100644 --- a/enrocrypt/encryption.py +++ b/enrocrypt/encryption.py @@ -113,24 +113,65 @@ def __Base_Auth_Encryption(self,data:bytes,optd:bytes = None): ed = encryptor.encrypt(password,data,optd) print([key,password,ed]) return [key,password,ed] - + def __Base_AESCCM(self,data:bytes,optd:bytes = None): + password = Password_Creator() + key = AESCCM.generate_key(256) + encryptor = AESCCM(key) + ed = encryptor.encrypt(password,data,optd) + return [key,password,ed] + def __Base_AESGCM(self,data:bytes,optd:bytes = None): + password = Password_Creator() + key = AESGCM.generate_key(256) + encryptor = AESGCM(key) + ed = encryptor.encrypt(password,data,optd) + return [key,password,ed] def Auth_Encryption(self,data:bytes,optd:bytes = None): '''You Can't Choose Your Passwords For Security Reasons. data: The Data You Wnat To Encrypt. optd: Optional Data You Wnat To Give. We Recommend You Give The optd.''' basee = self.__Base_Auth_Encryption(data,optd) + key = self.__Keyencryption(basee[0]) #password + password = self.__Keyencryption(basee[1]) #key + encd = self.__dataencryption(basee[2]) #data + final = [] + final.append('Key →');final.append(key);final.append('Password →');final.append(password);final.append('Encrypted Data →');final.append(encd);final.append('Optional Data →');final.append(optd) + return final + def Auth_Decryption(self,key:bytes,password:bytes,data:bytes,optd:bytes = None): + Key = self.__Keydecryption(key) + Password = self.__Keydecryption(password) + Data = self.__datadecryption(data) + decryptor = ChaCha20Poly1305(Key) + value = decryptor.decrypt(Password,Data,optd) + return value + def AESCCM(self,data:bytes,optd:bytes = None): + basee = self.__Base_AESCCM(data,optd) key = self.__Keyencryption(basee[0]) password = self.__Keyencryption(basee[1]) encd = self.__dataencryption(basee[2]) final = [] final.append('Key →');final.append(key);final.append('Password →');final.append(password);final.append('Encrypted Data →');final.append(encd);final.append('Optional Data →');final.append(optd) return final - def Auth_Decryption(self,key:bytes,password:bytes,data:bytes,optd:bytes = None): + def AESCCM_Decryption(self,key:bytes,password:bytes,data:bytes,optd:bytes = None): Key = self.__Keydecryption(key) Password = self.__Keydecryption(password) Data = self.__datadecryption(data) - decryptor = ChaCha20Poly1305(Key) + decryptor = AESCCM(Key) + value = decryptor.decrypt(Password,Data,optd) + return value + def AESGCM(self,data:bytes,optd:bytes = None): + basee = self.__Base_AESGCM(data,optd) + key = self.__Keyencryption(basee[0]) + password = self.__Keyencryption(basee[1]) + encd = self.__dataencryption(basee[2]) + final = [] + final.append('Key →');final.append(key);final.append('Password →');final.append(password);final.append('Encrypted Data →');final.append(encd);final.append('Optional Data →');final.append(optd) + return final + def AESGCM_Decryption(self,key:bytes,password:bytes,data:bytes,optd:bytes = None): + Key = self.__Keydecryption(key) + Password = self.__Keydecryption(password) + Data = self.__datadecryption(data) + decryptor = AESGCM(Key) value = decryptor.decrypt(Password,Data,optd) return value - \ No newline at end of file + \ No newline at end of file diff --git a/setup.py b/setup.py index 5c37f72..cb9734f 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ file = open('README.md','r').read() setup( name="enrocrypt", - version="1.0.5", + version="1.0.6", author="Morgan-Phoenix", author_email="mikebrain61@gmail.com", description="This is a Python Module For Encryption, Hashing And Other stuff",