//16进制字符串转为字节数组
private byte[] hexToByteArr(string hexStr)
{
hexStr = hexStr.ToLower();
string[] hexStrSplit = hexStr.Split(‘ ‘);
byte[] byteArr = new byte[hexStrSplit.Length / 2];
int i = 0;
foreach (string hex in hexStrSplit)
{
int value = Convert.ToInt32(hex, 16);
byteArr[i] = (byte)value;
}
return byteArr;
}
原文:https://www.cnblogs.com/lei-zi/p/14377545.html