From f3cabb4f33e5c417c43a83afc7ce117ff6eff827 Mon Sep 17 00:00:00 2001 From: Muhammed Serhat Mutlu Date: Thu, 25 Sep 2025 14:38:52 +0300 Subject: [PATCH] missing parts added and encoded parts fixed --- Cipher.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Cipher.java b/Cipher.java index 7527c5b..3377bbf 100644 --- a/Cipher.java +++ b/Cipher.java @@ -15,7 +15,7 @@ public String encrypt(String inputString) { // for all chars in the input string for (int i = 0; i < inputString.length(); i++) { - + outputString += replaceChar(inputString.charAt(i), true); } return outputString; @@ -25,8 +25,13 @@ public String decrypt(String inputString) { // output string will be collected in this variable, one char at a time String outputString = ""; + + // for all chars in the input string + for (int i = 0; i < inputString.length(); i++){ + // append the encrypted version of the char to the output string + outputString += replaceChar(inputString.charAt(i), false); + } - replaceChar('a',true); return outputString; } @@ -42,7 +47,7 @@ private char replaceChar(char inputChar, boolean isEncrypt) { for (int i = 0; i < ORIGINAL_ALPHABET.length(); i++) { if(ORIGINAL_ALPHABET.charAt(i) == inputChar) { - + return CIPHER_ALPHABET.charAt(i); } } }