circuitpython/tests/extmod/ucryptolib_aes128_ecb_into.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

17 lines
326 B
Python

# Operations with pre-allocated output buffer
try:
from ucryptolib import aes
except ImportError:
print("SKIP")
raise SystemExit
crypto = aes(b"1234" * 4, 1)
enc = bytearray(32)
crypto.encrypt(bytes(range(32)), enc)
print(enc)
crypto = aes(b"1234" * 4, 1)
dec = bytearray(32)
crypto.decrypt(enc, dec)
print(dec)