ucryptolib_aes128_ecb_into.py 326 B

12345678910111213141516
  1. # Operations with pre-allocated output buffer
  2. try:
  3. from ucryptolib import aes
  4. except ImportError:
  5. print("SKIP")
  6. raise SystemExit
  7. crypto = aes(b"1234" * 4, 1)
  8. enc = bytearray(32)
  9. crypto.encrypt(bytes(range(32)), enc)
  10. print(enc)
  11. crypto = aes(b"1234" * 4, 1)
  12. dec = bytearray(32)
  13. crypto.decrypt(enc, dec)
  14. print(dec)