帧校验序列码FCS

private static string FCS(string s)
{
int xorResult = 0;
string tempfes = "";
for (int i = 0; i < s.Length; i++)
{
xorResult = xorResult ^ Convert.ToInt32(s[i]);
}
tempfes = Convert.ToString(xorResult, 16);
//补0
if (tempfes.Length == 1)
{
tempfes = "0" + tempfes;
}
return tempfes.ToUpper().Replace(" ","");
}

猜你喜欢

转载自www.cnblogs.com/zhangsir95/p/10004045.html