Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def cbc_enc(key,iv,message):
- cipher_cbc = AES.new(key, AES.MODE_CBC, iv=iv)
- return cipher_cbc.encrypt(Padding.pad(message, 16))
- def cbc_dec(key,iv,ciphertext):
- cipher_cbc = AES.new(key, AES.MODE_CBC, iv=iv)
- return Padding.unpad(cipher_cbc.decrypt(ciphertext), 16)
- k = b'einszweidreivier'
- iv = b'1234567890abcdef'
- c = cbc_enc(k, iv, b'Hallo Wel asd asdasdasa asd asdas da asd dasd asdasd asd asd d at')
- print(c.hex())
- print(cbc_dec(k, iv, c))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement