Skip to content

Conversation

@hlord2000
Copy link
Contributor

Adds fix for case where custom delimiter is equal to overhead byte
Adds tests for custom delimiters
Simplified implementation

Signed-off-by: Helmut Lord [email protected]

Adds fix for case where custom delimiter is equal to overhead byte
Adds tests for custom delimiters
Simplified implementation

Signed-off-by: Helmut Lord <[email protected]>
@zephyrbot zephyrbot added area: Utilities area: Tests Issues related to a particular existing or missing test labels Dec 17, 2025
@hlord2000
Copy link
Contributor Author

@pdgendt per comment in #101004

@sonarqubecloud
Copy link

@pdgendt
Copy link
Contributor

pdgendt commented Dec 17, 2025

There isn't an official specification of how the delimiter/sentinel byte should be used for encoding/decoding AFAIK.
In my go library I took inspiration from the rust cobs library used in Tokio.

The overhead byte encodes the length of the block, but leaps the delimiter/sentinel value. For decoding the overhead length byte, you simply have to subtract 1 if it is larger than the delimiter/sentinel, otherwise you don't.

@pdgendt
Copy link
Contributor

pdgendt commented Dec 17, 2025

Searching further on the topic of a custom delimiter I found the paper https://conferences.sigcomm.org/sigcomm/1997/papers/p062.pdf
Where the encoded output stream is XOR'd with the delimiter value. I think this is an even more elegant solution (and I will update my own library accordingly).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Tests Issues related to a particular existing or missing test area: Utilities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants