示例#1
0
        public static string EncryStrHexUTF8(string Str, string Key)
        {
            string StrResult, Temp;//TempResult,
            int    i;

            byte[] byStr = Encoding.Default.GetBytes(Str);
            byStr = Encoding.Convert(Encoding.Default, Encoding.UTF8, byStr);

            byte[] byKey = Encoding.Default.GetBytes(Key);
            byKey = Encoding.Convert(Encoding.Default, Encoding.UTF8, byKey);

            StrResult = "";
            byte[] byTR = EncryStr(byStr, byKey);

            for (i = 0; i < byTR.Length; i++)
            {
                Temp = string.Format("{0:x}", (int)byTR[i]);
                if (Temp.Length == 1)
                {
                    Temp = "0" + Temp;
                }
                StrResult = StrResult + Temp;
            }
            return(StrResult.ToUpper());
        }
示例#2
0
        public static string EncryStrHex(string Str, string Key)
        {
            string StrResult, Temp;// TempResult,
            int    i;

            byte[] byEncStr = EncryStr(Str, Key);
            StrResult = "";
            for (i = 0; i < byEncStr.Length; i++)
            {
                Temp = string.Format("{0:x}", byEncStr[i]);
                if (Temp.Length == 1)
                {
                    Temp = "0" + Temp;
                }
                StrResult = StrResult + Temp;
            }

            return(StrResult.ToUpper());
        }