示例#1
0
        public static string DecodeXTFile(string string_0)
        {
            byte[] buffer = new byte[8];
            IDEAXT ideaxt = new IDEAXT();

            byte[] bytes = Encoding.Default.GetBytes("9781246350HQSTAR");
            ideaxt.encrypt_subkey(bytes);
            ideaxt.uncrypt_subkey();
            string str = "";

            try
            {
                int        count  = 0;
                FileStream stream = new FileStream(string_0, FileMode.Open);
                count = (int)stream.Length;
                byte[] buffer3 = new byte[count];
                byte[] buffer4 = new byte[count];
                stream.Read(buffer3, 0, count);
                for (int i = 0; i < (count / 8); i++)
                {
                    byte[] destinationArray = new byte[8];
                    Array.Copy(buffer3, i * 8, destinationArray, 0, 8);
                    ideaxt.encrypt(destinationArray, buffer);
                    for (int j = 0; j < 8; j++)
                    {
                        buffer4[(8 * i) + j] = buffer[j];
                    }
                }
                stream.Close();
                str = Encoding.Default.GetString(buffer4);
                int num4 = str.LastIndexOf("</body>");
                return(str.Substring(0, num4 + 7));
            }
            catch
            {
                return("");
            }
        }
示例#2
0
        public static string EncodeXTGoodsName(string string_0)
        {
            byte[] buffer = smethod_0(string_0, 8);
            int    length = buffer.Length;

            byte[] buffer2 = new byte[8];
            for (int i = 0; i < 8; i++)
            {
                buffer2[i] = 0;
            }
            byte[] buffer3 = new byte[8];
            IDEAXT ideaxt  = new IDEAXT();

            byte[] bytes = Encoding.Default.GetBytes("9781246350HQSTAR");
            ideaxt.encrypt_subkey(bytes);
            byte[] buffer5 = new byte[0x10];
            for (int j = 0; j < (length / 8); j++)
            {
                byte[] buffer6 = new byte[8];
                for (int m = 0; m < 8; m++)
                {
                    buffer6[m] = buffer[(j * 8) + m];
                }
                ideaxt.encrypt(buffer6, buffer3);
                for (int n = 0; n < 8; n++)
                {
                    buffer2[n] = (byte)(buffer2[n] + buffer3[n]);
                }
            }
            for (int k = 0; k < 8; k++)
            {
                byte num6 = Convert.ToByte((int)(Convert.ToByte('A') + (buffer2[k] & 15)));
                buffer5[2 * k]       = num6;
                num6                 = Convert.ToByte((int)(Convert.ToByte('A') + (buffer2[k] >> 4)));
                buffer5[(2 * k) + 1] = num6;
            }
            return(Encoding.Default.GetString(buffer5));
        }