Function cobs::decode_with_sentinel

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

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

This is done by XOR-ing each byte of the source message with the chosen sentinel value, which transforms the message into the same message encoded with a sentinel value of 0. Then the regular decoding transformation is performed.

The returned usize is the number of bytes used for the DECODED value, NOT the number of source bytes consumed during decoding.