Click here to Skip to main content
15,898,373 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
this my code:
C#
public static string StringToBinary(string data)
        {
            StringBuilder sb = new StringBuilder();

            foreach (char c in data.ToCharArray())
            {
                sb.Append(Convert.ToString(c, 2).PadLeft(8, '0'));
            }
            return sb.ToString();
        }

private void button12_Click(object sender, EventArgs e)
        {

            string plainText = "a"+textBox3.Text;
            string keyText = textBox4.Text;
            string binaryplain = StringToBinary(plainText);
            string binarykey = StringToBinary(keyText);

            int int1 = Convert.ToInt32(binaryplain, 2); //this trouble : Value was either too large or too small for a UInt32.
            int int2 = Convert.ToInt32(binarykey, 2);
            int int3 = int1 ^ int2;
            string hasil = Convert.ToString(int3,2);
            textBox5.Text = hasil;
        }

please help me...
Posted

1 solution

As you have not specified what the problem is, still you can look at following links to get the solution of your problem.
http://msdn.microsoft.com/en-us/library/zkacc7k1.aspx[^]
Understand how bitwise operators work (C# and VB.NET examples)[^]
http://www.dotnetperls.com/xor[^]

-KR
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900