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