ucryptolib_aes128_ecb_inpl.py 320 B

123456789101112131415
  1. # Inplace operations (input and output buffer is the same)
  2. try:
  3. from ucryptolib import aes
  4. except ImportError:
  5. print("SKIP")
  6. raise SystemExit
  7. crypto = aes(b"1234" * 4, 1)
  8. buf = bytearray(bytes(range(32)))
  9. crypto.encrypt(buf, buf)
  10. print(buf)
  11. crypto = aes(b"1234" * 4, 1)
  12. crypto.decrypt(buf, buf)
  13. print(buf)