ucryptography
C · Mbed TLS
Lightweight port of PyCA cryptography to MicroPython. Same import paths, so the same code runs unchanged on MicroPython and CPython.
- RSA · EC · Ed25519
- AES-GCM/CBC · HMAC · HOTP/TOTP
- X.509 certificates & CSRs
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import padding, rsa
message = b"A message I want to sign"
pss = padding.PSS(mgf=padding.MGF1(hashes.SHA256()), salt_length=32)
private_key = rsa.generate_private_key(public_exponent=65537, key_size=2048)
signature = private_key.sign(message, pss, hashes.SHA256())
private_key.public_key().verify(signature, message, pss, hashes.SHA256())
ucrypto
C · TomsFastMath
Fast RSA and elliptic-curve cryptography for MicroPython, focused on digital signatures. ECDSA API inspired by fastecdsa.
- ufastrsa: sign, verify, encrypt
- ufastecdsa: P-256 and friends
- Arbitrary curve arithmetic
from ufastecdsa import curve, ecdsa, keys
private_key, public_key = keys.gen_keypair(curve.P256)
m = "a message to sign via ECDSA"
r, s = ecdsa.sign(m, private_key)
print(ecdsa.verify((r, s), m, public_key)) # True
anx7625
C · Portenta H7
MicroPython video primitives for the Arduino Portenta H7: drive an HDMI display through the USB-C (ANX7625) bridge, with double-buffered page flipping and LVGL support.
- 800×600 RGB565 framebuffer
- Double-buffered page flip
- LVGL support
import _anx7625, framebuf, machine
i2c = machine.I2C(1, freq=400_000)
pins = machine.Pin.cpu
buf = bytearray(800 * 600 * 2 * 2)
anx = _anx7625.ANX7625(i2c, pins.K2, pins.J3, pins.J6, buf, width=800, height=600)
fb = framebuf.FrameBuffer(anx.framebuffer, anx.width, anx.height, framebuf.RGB565)
fb.text("Hello HDMI", 20, 16, 0xFFFF)
anx.flush()
uBLE
Pure Python
Lightweight Bluetooth Low Energy driver written in pure Python for MicroPython: control BLE chips from a PyBoard by speaking HCI directly.
- HCI packet parsing
- HCI packet building
- No native code
from binascii import hexlify
from bluetooth_low_energy.api.scanner import Scanner
for entry in Scanner().scan(5000):
print(hexlify(entry.address, ":"), entry.rssi, entry.get_data())