示例#1
0
        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            //radio5 - hex, radio4 - base64, radio6 - ascii
            radioButton4.Enabled = true;
            radioButton5.Enabled = true;
            radioButton6.Checked = true;

            if (XORTools.isBase64String(textBox2.Text))
            {
                radioButton4.Checked = true;
            }
            else
            {
                radioButton4.Enabled = false;
            }

            if (XORTools.isHexString(textBox2.Text))
            {
                radioButton5.Checked = true;
            }
            else
            {
                radioButton5.Enabled = false;
            }

            updateStr2Val(null, null);
        }
示例#2
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            radioButton2.Enabled = true;
            radioButton3.Enabled = true;
            radioButton1.Checked = true;

            if (XORTools.isBase64String(textBox1.Text))
            {
                radioButton3.Checked = true;
            }
            else
            {
                radioButton3.Enabled = false;
            }

            if (XORTools.isHexString(textBox1.Text))
            {
                radioButton2.Checked = true;
            }
            else
            {
                radioButton2.Enabled = false;
            }

            updateStr1Val(null, null);
        }
示例#3
0
        private void textBox2_TextChanged(object sender, EventArgs e) //string 2 tb
        {
            radioButton4.Enabled = true;                              //base64
            radioButton6.Enabled = true;                              //hex
            radioButton5.Checked = true;

            if (XORTools.isBase64String(textBox2.Text))
            {
                radioButton4.Checked = true;
            }
            else
            {
                radioButton4.Enabled = false;
            }

            if (XORTools.isHexString(textBox2.Text))
            {
                radioButton6.Checked = true;
            }
            else
            {
                radioButton6.Enabled = false;
            }

            if (radioButton6.Checked)
            {
                ciphertext2 = XORTools.hexToBytes(textBox2.Text);
            }
            else if (radioButton4.Checked)
            {
                ciphertext2 = Convert.FromBase64String(textBox2.Text);
            }
            else
            {
                ciphertext2 = XORTools.stringToBytes(textBox2.Text);
            }


            if (ciphertext2.Length > ciphertext1.Length && ciphertext2.Length != key.Length)
            {
                //resize key
                byte[] temp = new byte[ciphertext2.Length];
                for (int i = 0; i < key.Length; i++)
                {
                    temp[i] = key[i];
                }
                key = temp;
            }

            if (plaintext2.Length != ciphertext2.Length)
            {
                //resize plaintext 2
                byte[] temp = plaintext2;
                for (int i = 0; i < plaintext2.Length; i++)
                {
                    temp[i] = plaintext2[i];
                }
                plaintext2 = temp;
            }
        }
示例#4
0
 private void updateStr2Val(object sender, EventArgs e)
 {
     if (radioButton5.Checked)
     {
         str2Arr = XORTools.hexToBytes(textBox2.Text);
     }
     else if (radioButton4.Checked)
     {
         str2Arr = Convert.FromBase64String(textBox2.Text);
     }
     else if (radioButton6.Checked)
     {
         str2Arr = XORTools.stringToBytes(textBox2.Text);
     }
 }
示例#5
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (radioButton7.Checked)
     {
         textBox3.AppendText("XOR of strings is: " + XORTools.bytesToHex(XORTools.xorByteArr(str1Arr, str2Arr)) + "\r\n");
     }
     else if (radioButton8.Checked)
     {
         textBox3.AppendText("XOR of strings is: " + XORTools.bytesToString(XORTools.xorByteArr(str1Arr, str2Arr)) + "\r\n");
     }
     else if (radioButton9.Checked)
     {
         textBox3.AppendText("XOR of strings is: " + Convert.ToBase64String(XORTools.xorByteArr(str1Arr, str2Arr)) + "\r\n");
     }
 }