https://github.com/amirhnajafiz-university/s7is02
Second project of Information Security course.
https://github.com/amirhnajafiz-university/s7is02
aes aes-256 aes-encryption binascii data-encryption os pyaes secrets
Last synced: about 1 month ago
JSON representation
Second project of Information Security course.
- Host: GitHub
- URL: https://github.com/amirhnajafiz-university/s7is02
- Owner: amirhnajafiz-university
- License: mit
- Created: 2022-11-22T14:55:43.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-31T05:59:31.000Z (over 2 years ago)
- Last Synced: 2025-02-17T13:26:35.806Z (4 months ago)
- Topics: aes, aes-256, aes-encryption, binascii, data-encryption, os, pyaes, secrets
- Language: Python
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
S7IS02
Implementing **AES** _encryption_ and _decryption_ with Python. Data security second project. In this project I used the important data security modules in python.
- Secrets
- Pyaes
- OS
- BinasciiMore information about encryption can be found in ```encription``` module:
```python
class Encryption():
### __init__(self, key: private key, iv: initialization vector)
def __init__(self, key, iv):
self.key = binascii.unhexlify(key)
self.iv = iv
### encrypt(self, plaintext: input text)
### returns ciphertext
def encrypt(self, plaintext):
aes = pyaes.AESModeOfOperationCTR(self.key, pyaes.Counter(initial_value = self.iv))
return aes.encrypt(plaintext)
### decrypt(self, ciphertext: encrypted text)
### returns plaintext
def decrypt(self, ciphertext):
aes = pyaes.AESModeOfOperationCTR(self.key, pyaes.Counter(initial_value = self.iv))
return aes.decrypt(ciphertext)
```## Run
Add your key in ```private.key``` file. Run the program:
```shell
python main.py
```Results will be stored in ```gen``` directory (Please do not remove any files from ```gen``` directory).