Skip to content

Commit

Permalink
Added AES
Browse files Browse the repository at this point in the history
Added Two Types Of AES
* AESCCM
* AESGCM
  • Loading branch information
metamorphic-spyware committed Jun 29, 2021
1 parent efe3e66 commit 91997b2
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 9 deletions.
7 changes: 3 additions & 4 deletions enrocrypt/core.py
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -33,4 +33,3 @@ def get_hash_object(self):
hashing = Hashing()
hashing(bytes(self.salt.encode()))
return hashing

49 changes: 45 additions & 4 deletions enrocrypt/encryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]",
description="This is a Python Module For Encryption, Hashing And Other stuff",
Expand Down

0 comments on commit 91997b2

Please sign in to comment.