【C#】字符串字节转16进制字节数组
public static byte[] ConvertStringToBytes(String str)
{
List<byte> listBytes = new List<byte>();
string[] hexValuesSplit = str.Trim().Split(' ');
foreach (string hex in hexValuesSplit)
{
listBytes.Add(Convert.ToByte(hex, 16));
}
return listBytes.ToArray();
}