micropython/tests/extmod/ucryptolib_aes128_ecb_inpl.py
Paul Sokolovsky bb634115fc tests/extmod/ucryptolib*: Add into and inplace tests for ucryptolib.
Tests for separate input and output buffer (alloc-free operation) and
the same writable buffer used as input and output (inplace operation).
2018-06-27 14:56:46 +10:00

16 lines
320 B
Python

# Inplace operations (input and output buffer is the same)
try:
from ucryptolib import aes
except ImportError:
print("SKIP")
raise SystemExit
crypto = aes(b"1234" * 4, 1)
buf = bytearray(bytes(range(32)))
crypto.encrypt(buf, buf)
print(buf)
crypto = aes(b"1234" * 4, 1)
crypto.decrypt(buf, buf)
print(buf)