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 Blowfish
from Crypto.Util.Padding import unpad
import time
# define key and IV
key = b'KEYKEYKE'
iv = b'IVIVIVIV'
size_handling = [100000, 500000, 1000000 ,5000000,10000000]
for i in size_handling:
ciphertext = b'\xbf\x92\xfd\x9eV\xa7uU\xb7A\x87\xec_\xf0\xa7\xe7\x06k\xb5\x98\x89\xeb`\xaf2\x7f\xe3\xa2\x08z\x8f\xd9\x97\xd9$"\x9d\x15?\x05\xf0P@\x90B\xb9\x9a;' * i
t1 = time.time()
# create cipher object with Blowfish algorithm in CBC mode
cipher = Blowfish.new(key, Blowfish.MODE_CBC, iv)
# decrypt the ciphertext
decrypted_padding = cipher.decrypt(ciphertext) # decryption
plaintext = unpad(decrypted_padding, Blowfish.block_size) #remove padding
t2 = time.time()
t3 = t2 - t1 #total time to decrypt according to file size
print(f'time taken to decrypt: {t3} for size bytes: {i}')