Exemple #1
0
 private void textBox4_TextChanged(object sender, EventArgs e)
 {
     try
     {
         textBox5.Text = string.Format("Default:\r\n{0}\r\nASCII:\r\n{1}\r\nUTF8:\r\n{2}\r\n",
                                       Encoding.Default.GetString(BitTools.StringToBytes(textBox4.Text)),
                                       Encoding.ASCII.GetString(BitTools.StringToBytes(textBox4.Text)),
                                       Encoding.UTF8.GetString(BitTools.StringToBytes(textBox4.Text)));
     }
     catch
     {
         textBox5.Text = "";
     }
 }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            MapleAES m_Cipher = null;

            string strIv = textBox1.Text.Trim();

            byte[] Iv = BitTools.StringToBytes(strIv);

            string strData = textBox2.Text.Trim();

            byte[] Data = BitTools.StringToBytes(strData);

            if (radBtn_SendIV.Checked)
            {
                m_Cipher = new MapleAES(Iv, this.mapleVersion);
            }
            else if (radBtn_RecvIV.Checked)
            {
                m_Cipher = new MapleAES(Iv, (ushort)(0xFFFF - this.mapleVersion));
            }

            if (checkBox1.Checked)
            {
                m_Cipher.updateIv();
            }
            try
            {
                byte[] packetBuffer = new byte[Data.Length - 4];
                Buffer.BlockCopy(Data, 4, packetBuffer, 0, packetBuffer.Length);

                m_Cipher.crypt(packetBuffer);

                textBox3.Text = BitConverter.ToString(packetBuffer).Replace("-", " ");
            }
            catch
            {
            }
        }