title: How to encode plain text using lfsr, in c++?
body: <p>I have an assignment to &quot;encode plain text using lfsr with x9+x3+1 polynome/taps&quot;,Im understand base idea of lfsr, but im confused about how to implement it in c++, and more to the point, how to apply it to plain text in a way, which allows to decode it later. Does &quot;encryption of plain text&quot; implies that i need to extract XOR of 9,3,1 taps (or (x9^x3)^1? like &quot;1&quot; in not a tap but just a number 1?) from first symbol in the text, then shift bytes of second symbol to the right, and append value of previous XOR to it, and then just keep goin to the end of the file? If so, then how can i decode the text after?</p>
  <p>I would appreciate if someone could just give me small example but with explanation of what operator does what, exactly. In the file of the assignment it gives an example of the LFSR for x7+x6+x2 taps .But it never explains what doing what. I cant figure out how x7+x6+x2 translates into:</p>
  <pre><code>int LFSR ()
  {
  static unsigned long ShiftRegister = 79; 
  ShiftRegister =
  ((((ShiftRegister &gt;&gt; 6) ^ (ShiftRegister &gt;&gt; 2)) &amp; 0x01) &lt;&lt; 6) | (ShiftRegister &gt;&gt; 1);
  return ShiftRegister &amp; 0x01;
  </code></pre>