枯竹大师

导航

帧校验序列码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(" ","");
}

posted on 2018-11-22 21:26  枯竹大师  阅读(673)  评论(0)    收藏  举报