1

I am currently working on a python implementation for a 802.11 conform ofdm packet-crafter. Now I am struggling with the implementation of the bit-scrambler, as it is producing different output than shown in the IEEE Standard.

Block-diagram and generator polynomial are shwon in the image:Block diagram from IEEE 802.11 Standard

The scrambling seed, i.e. the initial scrambler state, is given in the Standard's example with [1, 0, 1, 1, 1, 0, 1]. I tripple checked, that my input bit-array for the scrambler is the same as in the example. My output, however, is similar only in the beginning and at the end of the scrambled array.

My implementation so far (using numpy):

def scrambler(inBits, seed):
    state = np.array(seed, dtype=np.uint8)
    outBits = np.zeros(len(inBits), dtype=np.uint8)
    for idx in range(len(inBits)):
        feedback = state[0] ^ state[3]
        outBits[idx] = feedback ^ inBits[idx]
        state[0:6] = state[1:]
        state[-1] = feedback
    return outBits

Is my implementation flawed? Thanks for every hint and your time!

Cheers Luuke

Luuke L
  • 21
  • 3
  • In the diagram there's this switch which would flip over after the first `len(seed)` bits. So I think the first 7 `inBits` should be +'ed with the seed bits directly, and only after that the +'ing with `state[0] ^ state[3]` as in your implementation should start. Not entirely sure though. :/ – Jeronimo Apr 15 '20 at 13:26
  • @Jeronimo Thanks for the tip, I've already tried that (should have mentioned it, sorry) but it diverged even more from the desired output. – Luuke L Apr 15 '20 at 13:55
  • Running `scrambler([0]*128, [1,0,1,1,1,0,1])` returns `[0 1 1 0 1 1 0 0 0 0 0 1 1 0 0 1 1 0 1 0 1 0 0 1 1 1 0 0 1 1 1 1 0 1 1 0 1 0 0 0 0 1 0 1 0 1 0 1 1 1 1 1 0 1 0 0 1 0 1 0 0 0 1 1 0 1 1 1 0 0 0 1 1 1 1 1 1 1 0 0 0 0 1 1 1 0 1 1 1 1 0 0 1 0 1 1 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 1 1 0 0 0 1 0 1 1 1 0 1 0]` as expected -- reading my copy of 802.11a-1999(R2003). The usual gotcha with this stuff is that the bit-stream is Bit0 first. – Chris Hall Apr 15 '20 at 18:01
  • @ChrisHall Thank you! My Bitorder was indeed the problem. – Luuke L Apr 16 '20 at 07:57

0 Answers0