title: CRC32 From C++/C# to PHP
body: <p>I'm not good at algorithms like CRC32, MD5 etc. so I'm even having difficulty asking the question :)</p>
  
  <p>Basically there is a C# application that uses</p>
  
  <pre><code>[DllImport("Crc32.dll")]
  private static extern UInt32 CRC32Calc(UInt32 crc32, byte[] buffer, uint length);
  </code></pre>
  
  <p>and further down in the code uses it in a method <code>Generate</code> like this</p>
  
  <pre><code>UInt32 crc = CRC32Calc(crcSeed, rawData, (uint)rawData.Length);
  </code></pre>
  
  <p>while using a certain <code>crcSeed</code> value.</p>
  
  <p>My job is to rework the entire <code>Generate</code> method into a PHP function while preserving the correct CRC calculation.</p>
  
  <p>I think that the PHP's </p>
  
  <pre><code>int crc32 ( string $str )
  </code></pre>
  
  <p>function will not work because I can't set the crcSeed. So my question is:</p>
  
  <p><strong>how can I make the exact crc32 calculation in PHP without resorting to outside dll's etc. so I can use the code an a Linux machine?</strong></p>
  
  <p>EDIT:</p>
  
  <p>CRC is calculated in chunks with the crcSeed being the initial one.</p>
  
  <p>The CRC32Calc method is actually using the SCTP CRC-32C version, so now, only a PHP implementation is needed.</p>