decode

Function decode 

Source
pub fn decode(fragments: &[EncodedFragment]) -> BpResult<Vec<u8>>
Expand description

Reconstruct the original chunk from k (or more) linearly independent fragments.

Uses Gaussian elimination over GF(2⁸) on the augmented matrix [coding_vectors | fragment_data].

The returned bytes include any zero-padding added during encoding — the caller is responsible for stripping trailing padding to the original length (stored in the file manifest, not in the fragment itself).

§Errors

  • Fewer than k fragments provided.
  • Fragments are linearly dependent (singular matrix).
  • Inconsistent k or data length across fragments.