Consistent Overhead Byte Stuffing

Created on 2023-10-08T06:11:43-05:00

Return to the Index

This card pertains to a resource available on the internet.

This card can also be read via Gemini.

COBS works by splitting an input payload in to "sections," postprocessing the sections, then emitting the whole new output buffer.

Each section starts with a zero byte, then up to 254 bytes of any byte which is not the Forbidden Byte. Then the header byte (the zero you added at the start) is changed to the number of bytes to skip to reach the next zero in the output.

The total payload always ends with the Forbidden Byte (usually zero.)

Example without forbidden bytes

Encoding deadbeef:
DE AD BE EF

Place in to sections delineated by forbidden bytes
00 DE AD BE EF 00

Replace the header
05 DE AD BE EF 00

Example with forbidden bytes

Encoding deadbeef:
DE AD 00 BE EF

Place in to sections delineated by forbidden bytes
00 DE AD | 00 BE EF 00

Replace the header
03 DE AD 03 BE EF 00