class Lasercontrol
{
/// <summary>
/// 获取校验码
/// </summary>
/// <param name="_bs">传入明文</param>
/// <returns>返回校验后的文本</returns>
byte[] crc(byte[] _bs)
{
byte[] all = new byte[_bs.Length + 4];
byte b0 = _bs[0];
for (int index = 1; index < _bs.Length; index++)
{
b0 = (byte)(b0 ^ _bs[index]);
}
all = new byte[_bs.Length + 4];
Array.Copy(new byte[] { 0x02, 0x05 }, 0, all, 0, 2);
Array.Copy(new byte[] { 0x03 }, 0, all, all.Length - 2, 1);
Array.Copy(_bs, 0, all, 2, _bs.Length);
Array.Copy(new byte[] { (byte)(b0 ^ 0x05) }, 0, all, all.Length - 1, 1);
retu
激光打码机通讯控制编码
最新推荐文章于 2023-02-09 17:28:02 发布