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