vigenere

The Vigenere algorithm in C# explanation

懵懂的女人 提交于 2019-12-11 01:55:02
问题 I came across this code: Byte Vigenere Cipher, error with decryption But trying to follow the rules I made a new question about it. The following algorithm is used and I'm trying to get a better understanding into 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)