Expand description
§rlnc-simdx — Random Linear Network Coding over GF(2⁸)
High-performance, no_std-compatible RLNC implementation with maximum
SIMD acceleration across all major architectures.
Crate: rlnc-simdx · use as use rlnc_simdx::....
§⚠️ Security & cryptography warning
This is a network-coding acceleration library, not a cryptography library.
- Do not use it to “encrypt” or obfuscate confidential data.
- Field arithmetic is not constant-time — no side-channel resistance.
- Built-in
SimpleRngis a fast LFSR for coding coefficients, not a CSPRNG. - Authenticate and protect coded packets with external crypto (TLS, AEAD, etc.).
§Kernel safety (public API)
kernel::axpy/kernel::scale: equal lengths and non-overlapping buffers are asserted in release (cheap pointer-range check).- For in-place scale use
kernel::scale_inplace. - Raw SIMD tier functions are crate-private; only the safe wrappers above are part of the supported public surface.
§SIMD Tier Hierarchy
With std, the library selects the best available kernel at runtime and
caches that choice. Without std, it selects from compile-time target features.
| Tier | Feature flags | Width | Throughput |
|---|---|---|---|
| 1 | GFNI + AVX-512BW | 512-bit | ~64 B/cy |
| 2 | GFNI + AVX2 | 256-bit | ~32 B/cy |
| 3 | GFNI + SSE4.2 | 128-bit | ~16 B/cy |
| 4 | AVX-512BW + SSSE3 | 512-bit | ~11 B/cy |
| 5 | AVX2 + SSSE3 | 256-bit | ~5 B/cy |
| 6 | SSSE3 | 128-bit | ~3 B/cy |
| 7 | NEON (AArch64) | 128-bit | ~3 B/cy |
| 8 | WASM SIMD128 | 128-bit | ~3 B/cy |
| 9 | Scalar (all targets) | 1 byte | ~0.3 B/cy |
SVE is experimental, has no production kernel, and is not selected by dispatch.
§Feature Flags
| Flag | Default | Effect |
|---|---|---|
alloc | on | Enables heap-backed RLNC APIs and GfMatrix |
std | on | Enables runtime CPU dispatch; implies alloc |
bench-internals | off | Unstable scalar/direct-tier benchmark APIs |
§Quick Start
use rlnc_simdx::{Encoder, Decoder, SimpleRng};
let k = 4; // generation size (number of source symbols)
let n = 128; // symbol size (bytes)
// Source data
let source: Vec<Vec<u8>> = (0..k).map(|i| vec![i as u8; n]).collect();
let refs: Vec<&[u8]> = source.iter().map(|v| v.as_slice()).collect();
// Encode
let enc = Encoder::new(k, n).unwrap();
let mut rng = SimpleRng::new(42);
let packets: Vec<_> = (0..k+2)
.map(|_| enc.encode_random(&refs, &mut rng).unwrap())
.collect();
// Decode
let mut dec = Decoder::new(k, n).unwrap();
for pkt in packets {
dec.receive(pkt).unwrap();
if dec.is_complete() { break; }
}
let decoded = dec.decode().unwrap().unwrap();
assert_eq!(decoded[0], source[0]);Re-exports§
pub use error::RlncError;pub use field::Gf8;pub use aligned::AlignedBuffer;pub use decoder::Decoder;pub use encoder::CodedPacket;pub use encoder::Encoder;pub use encoder::SimpleRng;pub use matrix::GfMatrix;pub use recoder::Recoder;
Modules§
- aligned
- Aligned memory buffer — 64-byte aligned heap storage for hot paths.
- decoder
- RLNC Decoder — in-place pivot-based Gaussian elimination over GF(2⁸).
- encoder
- RLNC Encoder — produces random linear coded packets over GF(2⁸).
- error
- Error types for the
rlnc-simdxcrate. - field
- GF(2⁸) finite field arithmetic.
- kernel
- Kernel dispatch layer — safe public API + runtime CPU feature detection.
- matrix
- GF(2⁸) matrix — row-major layout, 64-byte aligned backing store.
- recoder
- RLNC Recoder — re-encodes already-coded packets into new coded packets.
Functions§
- active_
kernel - Returns the name of the SIMD kernel tier active for this build.