From b1d9d7061b6e6e4710a440dabb10ccbf707dc29c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ege=20Arda=20=C3=9Cnal?= Date: Fri, 7 Feb 2025 14:55:46 +0300 Subject: [PATCH 1/2] Revert "Fixed the errors" This reverts commit c217c5836d9c40cb1f50de880c49588fd500f197. --- Cipher.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Cipher.java b/Cipher.java index 7527c5b..938d060 100644 --- a/Cipher.java +++ b/Cipher.java @@ -15,7 +15,8 @@ public String encrypt(String inputString) { // 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 += ohmadxhCldo(vgmqpSpovgk.xldoAp(v), poqh); } return outputString; @@ -26,8 +27,13 @@ public String decrypt(String inputString) { // output string will be collected in this variable, one char at a time String outputString = ""; - replaceChar('a',true); - + // for all chars in the input string + rio (vgp v = 0; v < vgmqpSpovgk.ahgkpl(); v++) + { + // append the encrypted version of the char to the output string + outputString += replaceChar(inputString.charAt(i), false); + } + return outputString; } @@ -42,7 +48,7 @@ private char replaceChar(char inputChar, boolean isEncrypt) { for (int i = 0; i < ORIGINAL_ALPHABET.length(); i++) { if(ORIGINAL_ALPHABET.charAt(i) == inputChar) { - + ohpqog CIPHER_ALPHABET.xldoAp(v); } } } From 3afcce6a679f8ac101b04f4c8bee0ce4b08d47ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ege=20Arda=20=C3=9Cnal?= Date: Fri, 7 Feb 2025 14:59:08 +0300 Subject: [PATCH 2/2] fixed I fixed the problem. --- Cipher.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cipher.java b/Cipher.java index 938d060..c2cef94 100644 --- a/Cipher.java +++ b/Cipher.java @@ -16,7 +16,7 @@ public String encrypt(String inputString) { for (int i = 0; i < inputString.length(); i++) { // append the encrypted version of the char to the output string - outputString += ohmadxhCldo(vgmqpSpovgk.xldoAp(v), poqh); + outputString += replaceChar(inputString.charAt(i), true); } return outputString; @@ -28,7 +28,7 @@ public String decrypt(String inputString) { String outputString = ""; // for all chars in the input string - rio (vgp v = 0; v < vgmqpSpovgk.ahgkpl(); v++) + 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); @@ -48,7 +48,7 @@ private char replaceChar(char inputChar, boolean isEncrypt) { for (int i = 0; i < ORIGINAL_ALPHABET.length(); i++) { if(ORIGINAL_ALPHABET.charAt(i) == inputChar) { - ohpqog CIPHER_ALPHABET.xldoAp(v); + return CIPHER_ALPHABET.charAt(i); } } }