66 935
Assignments Done
99,1%
Successfully Done
In October 2018

Answer to Question #21136 in C# for Abdallah

Question #21136
For encryption, we consider that the formula is: C = P XOR K, where

* C = encrypted code

* P = plain text

* K = key

For decryption the formula is: P = C XOR K. So, your program will try to find K using this formula. The XOR operator is ^.
Expert's answer
using System;
using System.IO;

class Program
{
public static void Main()
{
byte C, K, P;
Console.Write("Enter C: ");
C = byte.Parse(Console.ReadLine());
Console.Write("Enter P: ");
P = byte.Parse(Console.ReadLine());

K = (byte)(C ^ P);
Console.WriteLine("K = " + K);
Console.ReadKey();
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions