c#中实现16进制获取校验码,进制之间转换 | 乐文库-凯发k8官网下载客户端

 ///         /// 获取校验码        ///         /// 字节数组        /// 开始位置,包括此位置        /// 结束位置,包括此位置        /// 返回校验码        public static byte[] getcrc(byte[] bytes)        {            int crc = 0;            for (int i = 3; i > 8) & 0x00ff);            return result;        }        ///         /// 字节数组转16进制字符串        ///         ///         ///         public static string bytetohexstr(byte[] bytes)        {            string returnstr = "";            if (bytes != null)            {                for (int i = 0; i < bytes.length; i  )                {                    returnstr  = bytes[i].tostring("x2");                }            }            return returnstr;        }        ///         /// 字符串转十六进制        ///         ///         ///         public static byte[] strtohexbyte(string hexstring)        {            hexstring = hexstring.replace(" ", "");//删除空格            if ((hexstring.length % 2) != 0) hexstring  = " ";            byte[] returnbytes = new byte[hexstring.length / 2];            for (int i = 0; i
                                                         

本文来自网络,不代表乐文库立场,如若转载,请注明出处:https://www.lewenku.com/?p=466127

网站地图