Skip to main content

encode

Function encode 

Source
pub fn encode(message: &[u8], parity: u8) -> Result<Buffer, EncodeError>
Expand description

Encodes a message by adding an error-correcting code.

Messages longer than 255 - 2 * parity bytes are encoded in the long ECC format; all other messages become a single Reed-Solomon codeword.

ยงErrors

For messages that fit a single codeword:

  • RSConstructorError is returned if parity exceeds crate::MAX_PARITY.
  • RSEncodeError is returned if encoding fails.

For longer messages:

  • LongEccEncodeError is returned if long encoding fails.