Function cobs::encode_with_sentinel

source ·
pub fn encode_with_sentinel(
    source: &[u8],
    dest: &mut [u8],
    sentinel: u8
) -> usize
Expand description

Encodes the source buffer into the dest buffer using an arbitrary sentinel value.

This is done by first encoding the message with the typical sentinel value of 0, then XOR-ing each byte of the encoded message with the chosen sentinel value. This will ensure that the sentinel value doesn’t show up in the encoded message. See the paper “Consistent Overhead Byte Stuffing” for details.