The ASCII value for the capital A is 65. All characters in key
are converted to uppercase, this would simply return the alphabetical index of each letter in key
.
Each letter in key
is converted to a number that way, and each letter in the original string is "shifted up the alphabet" that number of positions.
If your key was BAD
, this would turn into the numbers 1, 0 and 3, then applied to "hello world" as follows:
Hello world
10310310310 <-- added to each character
Ieomo#xoumd
You can demonstrate this by adding this code below yours:
StringBuilder demonstration = new StringBuilder();
foreach (byte b in result)
{
demonstration.Append((char)b);
}
Console.WriteLine(demonstration.ToString());