C# 生成字符串的 CheckSum
PRivate static string CheckSum(string message){ char[] chars = message.ToCharArray(); int checksum = 0; for (int i = 0; i < chars.Length; i++) { checksum += (int)chars[i]; } checksum = (~checksum & 0xFFFF) + 0x0001; return Convert.ToString(checksum, 16).ToUpper();}
例如,字符串“1234567890” 的 CheckSum 为:“FDF3”
新闻热点
疑难解答