I came across this code:
Vigenere Cipher byte, decryption error
But trying to follow the rules, I asked a new question.
The following algorithm is used, and I'm trying to better understand it:
Byte[] result= new Byte[plaintext.Length];
key = key.Trim().ToUpper();
int keyIndex = 0;
int keylength = key.Length;
for (int i = 0; i < plaintext.Length; i++)
{
keyIndex = keyIndex % keylength;
int shift = (int)key[keyIndex] - 65;
result[i] = (byte)(((int)plaintext[i] + shift) % 256);
keyIndex++;
}
Do I think that you need to trim the key, as in Unicode? so subtracting 65 from capital gives a common symbol / symbol?
source
share