mrandrewmills/Vigenere-Cipher

Plaintext spaces vs. letter rotation of keyword

mrandrewmills opened this issue · 1 comments

Currently the encrypt function iterates through the letter rotation of the keyword for each character processed in the plaintext, rather than each letter. This causes an encrypt/decrypt mismatch between our encoder and third-party decoders after the first space occurs in the plain text.

Consider relocating line 105:

// don't forget to move to next letter in our password
pwIndex = pwIndex + 1;

within the else block located at line 98:

            } else {
                // otherwise find its counterpart in the V. table
                thisRow = this.alphabets[vRow];
                this.ciphertext += thisRow[thisLetter];
            }

You'll likely need to locate the counterpart code within the decrypt method and adjust as well.

Issue resolved.