title: Using GNU Radio scrambler and descrambler
body: <p>I'm trying to use the GNU Radio descrambling blocks. I have a block written by a third party that takes of descrambling. The polynomial used is x<sup>17</sup> + x<sup>12</sup> + 1.</p>
  
  <p>The code is given below</p>
  
  <pre><code>descrambler_cc_impl::descrambler_cc_impl()
    : gr::sync_block("descrambler_cc",
            gr::io_signature::make(1, 1, sizeof(unsigned char)),
            gr::io_signature::make(1, 1, sizeof(unsigned char)))
  {
      lsr = 0;
  }
  
  /*
   * Our virtual destructor.
   */
  descrambler_cc_impl::~descrambler_cc_impl()
  {
  }
  
  int
  descrambler_cc_impl::work(int noutput_items,
      gr_vector_const_void_star &amp;input_items,
      gr_vector_void_star &amp;output_items)
  {
    const unsigned char *in = (const unsigned char *) input_items[0];
    unsigned char *out = (unsigned char *) output_items[0];
    int i;
    for (i = 0; i &lt; noutput_items; i++) {
  out[i] = (lsr &amp; 1) ^ ((lsr &gt;&gt; 12) &amp; 1) ^ ((lsr &gt;&gt; 17) &amp; 1);
  lsr = lsr &lt;&lt; 1;
  lsr = lsr | (in[i] &amp; 1);
    }
  
    // Tell runtime system how many output items we produced.
    return i;
  }
  </code></pre>
  
  <p>Now I want to use the GNU Radio descrambler block. From<br>
  <a href="https://github.com/gnuradio/gnuradio/blob/master/gr-digital/include/gnuradio/digital/lfsr.h#L50-L52" rel="nofollow noreferrer">this link</a>, I calculated the descrambling parameters as follows : Mask - 0x0210001 ; seed - 0x00; length - 24.</p>
  
  <p>Unfortunately, it is not working as its counterpart in the code shown above. Could someone provide guidance as to why this is not working?</p>