Skip to main content

Module fec

Module fec 

Source
Expand description

Reed-Solomon FEC for SURB responses. D-of-(D+P) reconstruction over GF(2^8). Applied response-path only (exit -> client). All shards must be uniform size (last data shard zero-padded); output truncated to original_data_len.

Structs§

FecInfo
FEC parameters carried on every fragment (12 bytes). Present on all fragments because any could be dropped and the reassembler needs these from whichever arrives first.

Enums§

FecError

Functions§

decode_shards
Reconstruct original data from a (possibly incomplete) set of D+P shard slots. Fast path if all data shards present; RS reconstruction otherwise.
encode_parity_shards
Generate parity shards from uniform-length data shards using Reed-Solomon. Caller MUST zero-pad the last data shard to match the others before calling.
pad_to_uniform
Pad data shards to uniform size for RS alignment. Last chunk is zero-padded.