public static String ToBCC(this String Str)
{
try
{
Int32 code = 0;
Char[] chars = Str.ToCharArray();
for (Int32 i = 0; i < chars.Length; i++) { code ^= Convert.ToInt32(chars[i]); }
return code.ToString("X");
}
catch { return null; }
}
public static String ToBCC(this Byte[] bytes)
{
try
{
Int32 code = 0;
for (Int32 i = 0; i < bytes.Length; i++) { code ^= bytes[i]; }
return code.ToString("X");
}
catch { return null; }
}
C# 实现异或校验(BCC)
打赏
支付红包
微信打赏


C# 中GET请求,Body中携带参数
上一篇
2023-04-03 13:07:31
Modbus报文格式(TCP及RTU)
下一篇
2023-05-02 20:32:08