- class sdr.AdditiveScrambler
Implements an additive scrambler.
Notes¶
+--------------@<-------------@<------------@<-------------+ | ^ ^ ^ | | | c_n-1 | c_n-2 | c_1 | c_0 | | T[0] | T[1] | T[n-2] | T[n-1] | | | | | | +--------+ | +--------+ | | +--------+ | +->| S[0] |--+->| S[1] |--+--- ... ---+->| S[n-1] |--+ | +--------+ +--------+ +--------+ | v x[n] -->@--> y[n] S[k] = State vector T[k] = Taps vector x[n] = Input sequence y[n] = Output sequence @ = Finite field adder
References¶
Examples¶
Construct the additive scrambler used in IEEE 802.11.
# The characteristic polynomial In [1]: c = galois.Poly.Degrees([7, 3, 0]); c Out[1]: Poly(x^7 + x^3 + 1, GF(2)) # The feedback polynomial In [2]: f = c.reverse(); f Out[2]: Poly(x^7 + x^4 + 1, GF(2)) In [3]: scrambler = sdr.AdditiveScrambler(f)
Scramble and descramble a sequence.
In [4]: x = np.random.randint(0, 2, 20); x Out[4]: array([0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1]) In [5]: y = scrambler.scramble(x); y Out[5]: array([0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1]) In [6]: xx = scrambler.descramble(y); xx Out[6]: array([0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1]) In [7]: np.array_equal(x, xx) Out[7]: True
Constructors¶
- AdditiveScrambler(feedback_poly: PolyLike, ...)
Creates an additive scrambler.
Methods¶
- descramble(y: NDArray[int_]) NDArray[int_]
Descrambles the input sequence \(y[n]\).
Properties¶