我现在得一串字符,例如:0036303230303030303030303030303030303030303030303031303030303030303030323030,我想取得这串字串的校验码,怎么去做啊!
2 回答
qq_遁去的一_1
TA贡献1725条经验 获得超7个赞
string str ="0036303230303030303030303030303030303030303030303031303030303030303030323030";
char []ch= str.ToArray();
int sum = 0;
foreach (var b in ch)
{
sum += int.Parse(b.Tostring());
}
sum =sum % 255;//模FF
sum = ~sum + 1;//取反+1
string lrc = Convert.ToString(sum, 16);
- 2 回答
- 0 关注
- 1014 浏览
添加回答
举报
0/150
提交
取消