rcsa 0.1.0

DVB Common Scrambling Algorithm (CSA) descrambler and scrambler for MPEG-TS
Documentation
  • Coverage
  • 60%
    3 out of 5 items documented0 out of 0 items with examples
  • Size
  • Source code size: 201.6 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 661.4 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • cesbo/rcsa
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • and-cesbo

rcsa

Pure Rust DVB Common Scrambling Algorithm (DVB-CSA) for MPEG transport streams.

  • Descrambler: descrambles 188-byte TS packets in place with an even/odd control word pair. Payloads after an adaptation field and trailing partial blocks are handled; descrambled packets get their scrambling bits cleared.
  • CsaBatch: bitsliced batch of full-payload packets, 64 lanes (u64), 128 lanes (SSE2, NEON) or 256 lanes (AVX2, detected at runtime). Decrypt and encrypt.
  • Csa: one packet at a time, any payload length.

No dependencies; unsafe only in the SIMD backends and their dispatch.

Usage

use rcsa::Descrambler;

let mut descrambler = Descrambler::new();
descrambler.set_even(&cw[.. 8].try_into()?);
descrambler.set_odd(&cw[8 ..].try_into()?);

// a whole number of 188-byte packets; larger buffers are faster
descrambler.descramble(&mut packets);

When a new control word takes effect is up to the caller: set_even/set_odd replace the key immediately.

Performance

Descrambling real SD and HD channels, one core of a Xeon E5-2660 v3 (Haswell), buffers of 1024-4096 packets, payload Mbit/s. FFdecsa and libdvbcsa built with -O3 -msse2, rcsa with the default target (AVX2 picked at runtime):

Mbit/s
rcsa 1230-1280
FFdecsa 1070-1090
libdvbcsa 750-765

Without AVX2 (SSE2) rcsa does about 980 Mbit/s on the same CPU.