Example #1
0
 public static string Crc32HashFromString(string content)
 {
     Crc32 crc32 = new Crc32();
     String hash = String.Empty;
     foreach (byte b in crc32.ComputeHash(Encoding.UTF8.GetBytes(content))) hash += b.ToString("x2").ToLower();
     return hash;
 }
Example #2
0
 public static string Crc32Hash(string filepath)
 {
     Crc32 crc32 = new Crc32();
     String hash = String.Empty;
     using (FileStream fs = File.Open(filepath, FileMode.Open))
         foreach (byte b in crc32.ComputeHash(fs)) hash += b.ToString("x2").ToLower();
     return hash;
 }