Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#!/usr/bin/env python3
from Crypto.Cipher import AES
import os
import time
key = os.urandom(16)
iv = os.urandom(16)
# Create an AES-128 cipher object with the key and IV
cipher = AES.new(key, AES.MODE_CBC, iv)
size_handling = [100000,500000,1000000,5000000,10000000]
# Measure the time taken to encrypt encrypted_messages of increasing size
for i in size_handling:
encrypted_message = b'\x95lxk\xb5\xd8\xb7b9l\x153\x83}v\xceLT6U\xd6<\xf3\x92&\xb9P\x8a\x0f\xa1\xc9\x90+0\xb3zC\xbf\xa0\x89\xbf\xbb\xb5\xa8\x801c\x8d' * i
initial_time = time.time()
plaintext = cipher.decrypt(encrypted_message) #decrypts message
end_time = time.time()
total_time = end_time - initial_time #total time taken to decrypt
print(f"time taken for encrypted message to decrypt * {i} bytes: {total_time} seconds")