public static void Main()
Encryption XORProgram = new Encryption();
XORProgram.Encode("ABCDEF", "12345");
XORProgram.Decode("rtvxzw", "12345");
public string Encode(string msg, string key)
char[] row = new char[msg.Length];
for(int i=0; i<msg.Length; i++)
row[i] = (char)(msg[i] + key[i % key.Length]);
Console.WriteLine("Encode Message:" + new String(row));
public string Decode(string msg, string key)
char[] row = new char[msg.Length];
for(int i=0; i<msg.Length; i++)
row[i] = (char)(msg[i] - key[i % key.Length]);
Console.WriteLine("Dncode Message:" + new String(row));