SLIP and COBS encode/decode handling CinderBlock
C++
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
include
src
.gitignore
LICENSE
README.md
cinderblock.xml

README.md

Cinder-Encoding

Simple CinderBlock for SLIP and COBS encode / decode.

EXAMPLE

const size_t size = 12;
uint8_t data[size] = {
    0x45, 0x00, 0x00, 0x2C, 0x4C, 0x79, 0x00, 0x00, 0x40, 0x06, 0x4F, 0x37
};

// COBS using ci::BufferRef
auto buffer = Buffer::create(data, size);
auto encodedBuffer = COBSEncode(buffer);
auto decodedBuffer = COBSDecode(encodedBuffer);
if (decodedBuffer->getSize() != buffer->getSize()) {
    // 💀
}

// SLIP using raw uint8_t*
size_t maxEncodedSize = 2 * size + 2;
uint8_t encodedData[maxEncodedSize];
size_t encodedSize = SLIPEncode(data, size, encodedData);

size_t maxDecodedSize = encodedSize - 1;
uint8_t decodedData[maxDecodedSize];
size_t decodedSize = SLIPDecode(data, size, decodedData);
if (decodedSize != size) {
    // 💀
}

GREETZ