protected static UInt32 ComputeFingerprint(byte[] bytes, int length) { // Length correction is requred like in ComputeMessageIntegrity, but // I assume that Fingerprint is last item always. It's true in most cases. using (Crc32 crc32 = new Crc32()) { crc32.ComputeHash(bytes, 0, length); return crc32.CrcValue ^ 0x5354554e; } }
public static int getCRC(string inputString) { Crc32 crc = new Crc32(); crc.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(inputString)); return (int)crc.CrcValue; }
public static int CRC(byte[] bytes) { Crc32 crc32 = new Crc32(); return BitConverter.ToInt32(crc32.ComputeHash(bytes), 0); }