Skip to content

Commit a8f7de8

Browse files
committed
fix
1 parent 82bea9f commit a8f7de8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/thealgorithms/ciphers/Autokey.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public String decrypt(String ciphertext, String keyword) {
4444
char cipherChar = ciphertext.charAt(i);
4545
char keyChar = extendedKey.charAt(i);
4646

47-
int decryptedChar = (cipherChar - 'A' - keyChar - 'A' + 26) % 26 + 'A';
47+
int decryptedChar = (cipherChar - 'A' - (keyChar - 'A') + 26) % 26 + 'A';
4848
plaintext.append((char) decryptedChar);
4949

5050
extendedKey.append((char) decryptedChar); // Extend key with each decrypted char

0 commit comments

Comments
 (0)