Skip to content
Permalink
1ca5769fb9
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
23 lines (17 sloc) 713 Bytes
#!/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 messages of increasing size
for i in size_handling:
message = b'Which witch switched the Swiss wristwatches?' * i
initial_time = time.time()
ciphertext = cipher.encrypt(message) #encrypts secret message
end_time = time.time()
total_time = end_time - initial_time #total time taken to encrypt
print(f"time taken for secret message * {i} encryption bytes: {total_time} seconds")