From 6d69384e002d553e1e8fa42ae00a2fd0bf5cf31f Mon Sep 17 00:00:00 2001 From: mehmet halim <233568706+mhmthlm@users.noreply.github.com> Date: Fri, 30 Jan 2026 01:32:28 +0300 Subject: [PATCH] fixed cipher problems and syntax errors Cipher program is fixed --- Cipher.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Cipher.java b/Cipher.java index 938d060..3f6be13 100644 --- a/Cipher.java +++ b/Cipher.java @@ -5,7 +5,7 @@ public class Cipher // encryption involves mapping from original to cipher, for each letter we locate the character in the // original string and replace it with the cipher alphabet letter at the same position public static final String ORIGINAL_ALPHABET = "abcdefghijklmnopqrstuvwxyz"; - public static final String CIPHER_ALPHABET = "dfxyhrklvwuasgimnojpqetbcz"; + public static final String CIPHER_ALPHABET = "dfxyhrklvwuasgimnojpqetbcz"; public String encrypt(String inputString) { @@ -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,8 +28,8 @@ 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); } } }