kokke/tiny-AES-c
FreeSmall portable AES128/192/256 in C
About kokke/tiny-AES-c
A small and portable implementation of the AES encryption algorithms (ECB, CTR, and CBC modes) in C. Supports key sizes of 128, 192, and 256 bits via compile-time defines (AES192, AES256). Designed for minimal code size and memory footprint — uses less than 200 bytes of RAM and 1–2 KB of ROM when compiled for ARM targets. The library provides a simple API for initialization, encryption, and decryption, and allows selective compilation of modes (CBC, CTR, ECB). No padding is included; users must ensure buffer lengths are multiples of 16 bytes for CBC/ECB. The code has been tested on 64-bit x86, 32-bit ARM, and 8-bit AVR platforms. Released under the Unlicense (public domain). Ideal for embedded systems, IoT devices, and other resource-constrained environments where a lightweight AES implementation is needed.
Key Features
Pros & Cons
- Extremely small code size compared to other AES libraries
- Simple API and easy integration
- Supports multiple key sizes and encryption modes
- Portable across multiple architectures (x86, ARM, AVR)
- Public domain license allows unrestricted use
- Low memory footprint suitable for constrained hardware
- No built-in padding (user must ensure block-aligned buffers for ECB/CBC)
- ECB mode considered insecure for most applications and not implemented in streaming
- No error checking or protection against out-of-bounds memory access from malicious input
- Not optimized for high performance; designed for size over speed