Consistent Overhead Byte Stuffing: Difference between revisions

Content deleted Content added
Encoding examples: clarified and simplified
Encoding examples: mv highlight comment
Line 39:
 
These examples show how various data sequences would be encoded by the COBS algorithm. In the examples, all bytes are expressed as [[hexadecimal]] values, and encoded data is shown with text formatting to illustrate various features:
* An {{red|overhead byte}} appears at the beginning of every encoded packet. This byte does not correspond to a data byte; it is an additional byte that is prepended to the encoded output. Its value equals either (1) one plus the number of non-zero data bytes that follow, or (2) one plus the total number of data bytes (applies when no zero bytes occur in the data). It is effectively a pointer to the next packet byte that requires interpretation: if the addressed byte is non-zero (highlighted {{green|Green}}) then it is interpreted as an encoded zero data byte (highlighted {{green|Green}}) that points to the next zero data byte; if the addressed byte is zero then it is interpreted as a {{blue|zero byte}} end of packet symbol.
* '''Bold''' indicates a data byte that has not been altered by encoding. All non-zero data bytes remain unaltered.
* {{green|Green}} indicates a data byte that was altered by encoding. All zero data bytes are replaced during encoding by one plus the number of non-zero bytes that follow.