如何计算 .NET 中字符串的 CRC32(循环冗余校验和)?
这家伙似乎已经给你答案了。
https://damieng.com/blog/2006/08/08/calculate_crc32_in_c_and_net https://damieng.com/blog/2006/08/08/calculating_crc32_in_c_and_net
如果博客消失或破坏了 url,这里是 github 链接:
https://github.com/damieng/DamienGKit/blob/master/CSharp/DamienG.Library/Security/Cryptography/Crc32.cs https://github.com/damieng/DamienGKit/blob/master/CSharp/DamienG.Library/Security/Cryptography/Crc32.cs
博客文章中 Crc32 类的用法:
Crc32 crc32 = new Crc32();
String hash = String.Empty;
using (FileStream fs = File.Open("c:\\myfile.txt", FileMode.Open))
foreach (byte b in crc32.ComputeHash(fs)) hash += b.ToString("x2").ToLower();
Console.WriteLine("CRC-32 is {0}", hash);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)