Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def AESCBC(plainText, IV, key):
- >>> key = bytes([57, 226, 240, 61, 125, 240, 75, 68, 22, 35, 124, 205, 144, 27, 118, 220])
- >>> iv = bytes([241, 147, 66, 129, 194, 34, 37, 51, 236, 69, 188, 205, 64, 140, 244, 204])
- >>> decrypt_aes(bytes([255, 18, 67, 115, 172, 117, 242, 233, 246, 69, 81, 156, 52, 154, 123, 171]),key,iv)
- b'hello world 1234'
- >>> decrypt_aes(bytes([171, 218, 160, 96, 193, 134, 73, 81, 221, 149, 19, 180, 31, 247, 106, 64]),key,iv)
- b'lovecryptography'
- cipher = AES.new(key, AES.MODE_CBC, iv = IV)
- cipherText, tag = cipher.encrypt_and_digest(plainText)
- return cipherText
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement