title: Data conversion issue possibly, char to unsigned char. A software and firmware CRC32 interaction issue
body: <p>My current issue is that I am computing a CRC32 hash in software and then checking it in the firmware, however when I compute the hash in firmware its double what it is supposed to be. </p>
  
  <p>software(written in C#): </p>
  
  <pre><code>        public string SCRC(string input)
          {
              //Calculate CRC-32
              Crc32 crc32 = new Crc32();
              string hash = "";
  
              byte[] convert = Encoding.ASCII.GetBytes(input);
  
              MemoryStream ms = new MemoryStream(System.Text.Encoding.Default.GetBytes(input));
  
              foreach (byte b in crc32.ComputeHash(ms))
                  hash += b.ToString("x2").ToLower();
  
              return hash;
  
  
          }
  </code></pre>
  
  <p>firmware functions used(written in C):</p>
  
  <pre><code>unsigned long chksum_crc32 (unsigned char *block, unsigned int length)
  {
     register unsigned long crc;
     unsigned long i;
  
     crc = 0xFFFFFFFF;
     for (i = 0; i &lt; length; i++)
     {
        crc = ((crc &gt;&gt; 8) &amp; 0x00FFFFFF) ^ crc_tab[(crc ^ *block++) &amp; 0xFF];
     }
     return (crc ^ 0xFFFFFFFF);
  }
  
  /* chksum_crc32gentab() --      to a global crc_tab[256], this one will
   *              calculate the crcTable for crc32-checksums.
   *              it is generated to the polynom [..]
   */
  
  void chksum_crc32gentab ()
  {
     unsigned long crc, poly;
     int i, j;
  
     poly = 0xEDB88320L;
     for (i = 0; i &lt; 256; i++)
     {
        crc = i;
        for (j = 8; j &gt; 0; j--)
        {
           if (crc &amp; 1)
           {
              crc = (crc &gt;&gt; 1) ^ poly;
           }
           else
           {
              crc &gt;&gt;= 1;
           }
        }
        crc_tab[i] = crc;
     }
  }
  </code></pre>
  
  <p>Firmware Code where the functions above are called(Written in C):</p>
  
  <pre><code>//CommandPtr should now be pointing to the rest of the command      
          chksum_crc32gentab();
          HardCRC = chksum_crc32( (unsigned)CommandPtr, strlen(CommandPtr));
          printf("Hardware CRC val is %lu\n", HardCRC);
  </code></pre>
  
  <p>Note, the CommandPTR is a refrence to the same data named, "string input" in the software method.</p>
  
  <p>Does anyone have any idea why I could be getting approximately double the value I am using in the software??  Aka HardCRC is double what its supposed to be, I am guessing it has something to do with my unsigned char cast.</p>