Beispiel #1
0
 public static UInt32 CheckSumFile(string fileName)
 {
     CRC32 crc = new CRC32();
     int bufferLen = 32*1024;
     using (FileStream fs = File.OpenRead(fileName))
     {
         byte[] buffer = new byte[bufferLen];
         while (true)
         {
             int n = fs.Read(buffer, 0, bufferLen);
             if (n == 0) break;
             crc.Write(buffer, 0, n);
         }
     }
     return crc.Sum32();
 }
Beispiel #2
0
 public static UInt32 CheckSumBytes(byte[] data)
 {
     CRC32 crc = new CRC32();
     crc.Write(data, 0, data.Length);
     return crc.Sum32();
 }