USING PYTHON In this homework, please implement the cipher described below. Plea
ID: 3882700 • Letter: U
Question
USING PYTHON
In this homework, please implement the cipher described below. Please provide the encryption and decryption function (source code) and show screenshots that prove its operation.
The 160-bit (20-byte) key that you will use
Key = "ndnsstwlmheotpsciwuo"
Please make sure that:
- Python program runs without errors and provides encryption and decryption functions
- Code has comments that explain main steps of the implementation
- Screenshots show tests with encryption and decryption
The user should be able to type in a work such as "engineering" then have it encrypt. Then display that new encrypted message, and ask for another input after its done.
Explanation / Answer
Encryption and decryption using AES algorithm
from crypto import random
from crypto.cipher import AES
import basse64
BLOCK_SIZE=32
def encrypt(message,passphrase);
IV=random.new().read(BLOCK_SIZE)
aes=AES.new(passphrase,AES.MODE_CFB,IV)
return base64.b64encode(aes.encrypt(message))
def decrypt(encrypted,passphrase);
IV=random.new().read(BLOCK_SIZE)
aes=AES.new(passphrase,AES.MODE_CFB,IV)
return aes.decrypt(base64.b64decode(encrypted)).
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.