Tag Archives: library

Inline AES 256 / CBC Implementation

Today I like to share some encryption code, which can be used in various situations – and is also useful for embedded systems.

It is a unique implementation of the AES 256 / CBC crypto algorithm. The goal of this implementation was neither speed nor size. It was written to inline it into existing code.

The compiler will create a new instance of the algorithm on the fly, at the place where you insert it into the code. Depending of used optimization flags, this inlined code can get very compact.

Goals

I had numerous goals and constraints while I created this implementation:

  • Completely inline.
  • Generated by the compiler on the fly.
  • Easy to read and understand.
  • Suitable for embedded processors.
  • No static tables (S-Box) in memory or the binary.
  • Minimal dependencies (just stdint and cstddef headers).
  • Compatible with other AES 256 / CBC implementation.

The following things were not relevant to me:

  • Speed
  • Size
  • Multiple algorithms
  • Error checking of inputs

Requirements and Usage

The requirements are very minimal, all what you need is a C++17 compatible compiler which provides the stdint and cstddef headers for the uint32_t types and the size_t type.

Continue reading Inline AES 256 / CBC Implementation

A New Library for Meggy Jr RGB

I planed to create a game as a gift and use the really great Meggy Jr RGB platform for it. See the picture above, it’s a great game machine powered by the ATmega328P (buy it here). You can use the Arduino IDE to program it.

After assembling the device, I played a little bit around with the provided library — but was a bit disappointed by the library. This is a game device after all, but the library lack in my opinion some important things a game library need.

So I wrote a new library from scratch, using the provided schema and documentation (you can see the printed out schema in the background of the picture). Sometimes its better to start from scratch and learn from the mistakes of other libraries.

Today I release the first version of the library at GitHub here: https://github.com/LuckyResistor/LRMeggyJr. It has a proper API documentation and a few examples. I release this early, but hope to improve the documentation and add examples while I develop the actual game.

Download the release v1.2 as a ZIP

Continue reading A New Library for Meggy Jr RGB