mpyaes - utility library around ucryptolib.aes

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
Posts: 40
Joined: Sun Jun 26, 2016 9:15 am

mpyaes - utility library around ucryptolib.aes

Post by Iyassou » Sat Sep 12, 2020 2:50 pm

Hello all.

mpyaes (GitHub) is a utility library around ucryptolib's aes class. It handles AES encryption and decryption of bytes-like objects and files, and implements PKCS7 padding, which is handled in the background.

Encrypting and decrypting files makes use of a block-sized buffer and memoryview to not consume too much memory. Decryption is always zero-copy, made possible by decrypting in place and returning uctypes.bytearray_at up to where the padding begins.

Tested and working are:
  • 128-bit ECB mode
  • 128-bit CBC mode
  • 256-bit ECB mode
  • 256-bit CBC mode
Support for CTR mode is there, but I couldn't test it on my ESP32. Thoughts appreciated.

User avatar
Posts: 323
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil

Re: mpyaes - utility library around ucryptolib.aes

Post by rcolistete » Sun Sep 13, 2020 6:35 pm

Thanks, with your module it is a lot easier to encrypt/decrypt text and files.
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

Post Reply