Question: Task 2 : Encrypting with AES 1 2 8 - OFB Problem Statement: You need to encrypt a string using AES 1 2 8 in

Task 2: Encrypting with AES128-OFB
Problem Statement: You need to encrypt a string using AES128 in Output Feedback (OFB) mode.
Your Specific Inputs:
String to Encrypt: "Salam Alaikom wa Rahmat Allah wa Barakatoh, 437102453"
Key: "8aec9ec018cbb948"
IV (Initialization Vector): "3078f2270c8669ac"
Your Student ID: 437102453
Python Code Snippet:from Crypto.Cipher import AES
import hashlib
def encrypt_aes_ofb(input_str, key, iv):
cipher = AES.new(key, AES.MODE_OFB, iv)
ciphertext = cipher.encrypt(input_str.encode('utf-8'))
return ciphertext
def get_sha1_hash(data):
return hashlib.sha1(data).hexdigest()
if __name__=="__main__":
key = b''
iv = b''
input_string =""
encrypted_data = encrypt_aes_ofb(input_string, key, iv)
print("SHA1 Hash of Encrypted Output:", get_sha1_hash(encrypted_data))
Expected Output: You should provide the SHA1 hash of the encrypted output, ensuring your code can encrypt any string using the same key and IV to achieve full score.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!