public byte[] GetAndBytes(byte[] array, int len)
{
int crc = 0x0000;
for (int i = 0; i < len; i++)
{
crc += array[i];
}
string tempstr = Convert.ToString(crc, 16).PadLeft(4, '0');
byte[] Xor = new byte[2];
Xor[0] = (byte)Convert.ToInt32(tempstr.Substring(0, 2), 16);
Xor[1] = (byte)Convert.ToInt32(tempstr.Substring(2, 2), 16);
return Xor;
}
{
int crc = 0x0000;
for (int i = 0; i < len; i++)
{
crc += array[i];
}
string tempstr = Convert.ToString(crc, 16).PadLeft(4, '0');
byte[] Xor = new byte[2];
Xor[0] = (byte)Convert.ToInt32(tempstr.Substring(0, 2), 16);
Xor[1] = (byte)Convert.ToInt32(tempstr.Substring(2, 2), 16);
return Xor;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货