title: CRC calculation by example
body: <p>I'd like to confirm whether I grasped the concept of CRC calculations correctly. I'll provide two examples, the first is calculating the remainder using normal subtraction, the second uses this weird XOR stuff.</p>
  
  <p>Data bits: <em>D</em> = 1010101010.<br>
  Generator bits: <em>G</em> = 10001.</p>
  
  <p>1) Subtraction approach to calculate remainder:</p>
  
  <pre><code>10101010100000
  10001|||||||||
  -----|||||||||
    10001|||||||
    10001|||||||
    -----|||||||
    000000100000
           10001
           -----
            1111
  </code></pre>
  
  <p><em>R</em> = 1111.</p>
  
  <p>2) XOR approach:</p>
  
  <pre><code>10101010100000
  10001|||||||||
  -----|||||||||
    10001|||||||
    10001|||||||
    -----|||||||
    00000010000|
          10001|
          ------
          000010
  </code></pre>
  
  <p><em>R</em> = 0010.</p>