Advertisement
Tenac451

Untitled

Apr 6th, 2020
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. def cbc_enc(key,iv,message):
  2. cipher_cbc = AES.new(key, AES.MODE_CBC, iv=iv)
  3. return cipher_cbc.encrypt(Padding.pad(message, 16))
  4.  
  5. def cbc_dec(key,iv,ciphertext):
  6. cipher_cbc = AES.new(key, AES.MODE_CBC, iv=iv)
  7. return Padding.unpad(cipher_cbc.decrypt(ciphertext), 16)
  8.  
  9. k = b'einszweidreivier'
  10. iv = b'1234567890abcdef'
  11. c = cbc_enc(k, iv, b'Hallo Wel asd asdasdasa asd asdas da asd dasd asdasd asd asd d at')
  12. print(c.hex())
  13. print(cbc_dec(k, iv, c))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement