12345678910111213141516 |
- def decryptInCBC(key,fileNameToDecrypt,iv,fileNameToSavePT):
- iv = b64decode(iv)
- ct = b64decode(getDataInBytes(fileNameToDecrypt))
- cipher = AES.new(key, AES.MODE_CBC, iv)
- start=timer()
- pt = unpad(cipher.decrypt(ct), AES.block_size)
- end=timer()
- print("Time Taken to Decrypt is ",end-start)
- print("Time Taken to Decrypt per byte is ",(end-start)/len(pt))
- pt=pt.decode("utf-8")
- writeFile(pt,fileNameToSavePT)
- return pt
|