0
Encryption and decryption with ascii
How can you encrypt and decrypt a string using for loop and ascii code in c#?
8 Antworten
+ 1
You can add some number to every characters ascii code so it makes unreadable text. Like if you add 1, "hi" becomes "ij"
But it can be easy, so you can use the byte information and play with it, just be sure undoing the code results in unique output for a unique input.
0
I just need to encrypt a specific given string and decrypt that encrypted string. Thanks btw 😊
0
I have enrypted the string by changing ascii values of the characters in string. but now i am in confusion of how to decrypt the new value to its old form.
0
How did you change the ascii value? If you linearly added or subtacted a value do the opposite.
0
Console.WritLine("Enter Your String: ");
string s = Console.ReadLine();
foreach(char c in s)
{
Console.Write((int)c+2);
}
Console.ReadKey();
0
Now it is giving me output of 718885
0
Now i want to enter these ascii codes in the input and convert them back to the input i have entered before which is EVS
0
Don't return integers convert, (int)c+2 into a character again, like (char)((int)c+2) , I'm not sure if (char) works but you got the jist. Then while decryption you do -2 instead of +2 and keep everything else same