Skip to main content

decode_shards

Function decode_shards 

Source
pub fn decode_shards(
    shards: &[Option<Shard>],
    data_shards: u8,
    parity_shards: u8,
    hmac_key: &[u8],
    original_len: usize,
) -> Result<Bytes, CorrectionError>
Expand description

Decode Reed-Solomon shards back to original data.

Accepts partial shard sets (some may be None). Requires at least data_shards valid shards with passing HMAC tags.

ยงErrors

Returns CorrectionError::InsufficientShards if not enough valid shards, CorrectionError::HmacMismatch if HMAC verification fails, or CorrectionError::ReedSolomonError if decoding fails.