We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 82bea9f commit a8f7de8Copy full SHA for a8f7de8
src/main/java/com/thealgorithms/ciphers/Autokey.java
@@ -44,7 +44,7 @@ public String decrypt(String ciphertext, String keyword) {
44
char cipherChar = ciphertext.charAt(i);
45
char keyChar = extendedKey.charAt(i);
46
47
- int decryptedChar = (cipherChar - 'A' - keyChar - 'A' + 26) % 26 + 'A';
+ int decryptedChar = (cipherChar - 'A' - (keyChar - 'A') + 26) % 26 + 'A';
48
plaintext.append((char) decryptedChar);
49
50
extendedKey.append((char) decryptedChar); // Extend key with each decrypted char
0 commit comments