如何在C#中查找字符串的校验和



嗨,我想找到单个字符串的校验和。创建校验和的过程是什么?如何创建给定字符串的8位校验和。使用类似C#.net的

 string this= "This is a test string";

如何使用8位校验和查找此字符串的校验和。

以下是CRC8-http://www.sanity-free.com/146/crc8_implementation_in_csharp.html这是http://en.wikipedia.org/wiki/Cyclic_redundancy_check

您还可以在http://en.wikipedia.org/wiki/List_of_hash_functions

正如评论中提到的,您还可以使用一个标准加密哈希函数的下/上字节:

MD5 md5 = System.Security.Cryptography.MD5.Create();
byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
byte[] hash = md5.ComputeHash(inputBytes);
return hash[0];

最新更新