十六进制字符串异或实现

/// 
        /// 十六进制字符串异或操作
        /// 
        /// 
        /// 
        /// 
        public static string ConvertHexToXor2(string hex,string xor)
        {
            string newstring = "";
            for (int i = 0; i < hex.Length; i += 2)
            {
                string str = hex.Substring(i, 2);
                if (xor != "")
                {
                    newstring += (Convert.ToInt64(xor, 16) ^ Convert.ToInt64(str, 16)).ToString("X2");
                }
                else
                {
                    xor = str;
                }
            }
            return newstring;
        }

 

 

 

转载于:https://www.cnblogs.com/zhangwenbo0713/p/10956921.html

你可能感兴趣的:(十六进制字符串异或实现)