diff --git a/README.md b/README.md
index d9ccdea..5127f6c 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,93 @@
-# Caesar-Cipher-Encoder-Decoder
-A School Independent Project to create a 1 - 25 integer key Caesar Shift Encoder Decoder.
+# Caesar-Cipher-Encoder-Decoder By Chalie
+A School Independent Project to create a (1 to 25) integer key Caesar Shift Encoder Decoder.
+
+#### Description
+A Caesar cipher, also known as Caesar's cipher, the shift cipher, Caesar's code or Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of 3, D would be replaced by A, E would become B, and so on.Read More...
+
+### Live Release
+Live : Download Here
+Run the package using `java -jar Caesar-Cipher-Encoder-Decoder.jar`
+
+## Project Interface
+
+
+
+## Behaviour Driven Development
+
+- Displays banner and welcome message
+ - INPUT: "prompt for option selection"
+
+- Displays: "Prompt message input if encrypt Message option Entered"
+ - INPUT: "Enter the message to Encrypt prompt"
+ - INPUT: "Enter the shift/encryption key prompt"
+ - OUTPUT: "Displays User's input message, the encrypted message and the encryption/shift key"
+
+- Displays: "Prompt message input if decrypt Message option Entered"
+ - INPUT: "Enter the message to decrypt prompt"
+ - INPUT: "Enter the shift/decryption key prompt"
+ - OUTPUT: "Displays User's input message, the decrypted message and the decryption/shift key"
+
+- Displays: "Show goodbye and exit on exit option Entered"
+
+- Displays an Error Message if option selection is not a number or out of range"
+
+
+
+## Contributions
+If you'd like to contribute.
+- Fork the repo
+- Create a new branch (git checkout -b feature)
+- Make the appropriate changes in the files
+- Add changes to reflect the changes made
+- Commit your changes (git commit -m 'Improve/Add feature')
+- Push to the branch (git push origin feature)
+- Create a Pull Request
+[Make sure your code is properly commented]
+If you find a bug, kindly open an issue Here .
+If you'd like to request a new function, feel free to do so by opening an issue Here.
+
+## Cloning and Development setup
+`git clone https://github.com/Chal13W1zz/Caesar-Cipher-Encoder-Decoder.git && cd Caesar-Cipher-Encoder-Decoder`, then open the project using your favourite IDE
+
+## Clone and Build With Gradle
+`git clone https://github.com/Chal13W1zz/Caesar-Cipher-Encoder-Decoder.git && cd Caesar-Cipher-Encoder-Decoder && gradle compilejava && cd build/classes/java/main/ && java App`
+
+
+## Technologies Used
+- Java
+- Intellij IDEA CE
+
+## Known Bugs
+NullPointer Exceptions
+
+
+## Connect With Me
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+##
+MIT Licence
+Copyright © 2021, Chalie
+All rights reserved.
+
+
+
diff --git a/build.gradle b/build.gradle
index 2650abc..51fc1ff 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,6 +2,14 @@ plugins {
id 'java'
}
+jar {
+ manifest {
+ attributes(
+ 'Main-Class': 'App'
+ )
+ }
+}
+
group 'com.chalie.caesar'
version '1.0-SNAPSHOT'
diff --git a/src/main/java/App.java b/src/main/java/App.java
new file mode 100644
index 0000000..242a0bb
--- /dev/null
+++ b/src/main/java/App.java
@@ -0,0 +1,69 @@
+import java.io.Console;
+
+public class App {
+ public static final String RED = "\033[0;31m"; // RED
+ public static final String GREEN = "\033[0;32m"; // GREEN
+ public static final String BLUE = "\033[0;34m"; // BLUE
+ public static final String NEUTRAL = "\033[0m"; // NEUTRAL
+ public static void main(String[] args){
+ Console myConsole = System.console();
+ CaesarShift myCaesar = new CaesarShift();
+ boolean running = true;
+ String version = "V1.0";
+
+ System.out.println(BLUE+" ____ ____ _ _ __ _ \n" +
+ " / ___|__ _ ___ ___ __ _ _ __/ ___|| |__ (_)/ _| |_ \n" +
+ "| | / _` |/ _ \\/ __|/ _` | '__\\___ \\| '_ \\| | |_| __|\n" +
+ "| |__| (_| | __/\\__ \\ (_| | | ___) | | | | | _| |_ \n" +
+ " \\____\\__,_|\\___||___/\\__,_|_| |____/|_| |_|_|_| \\__|"+version+NEUTRAL);
+ System.out.println(RED+" Encrypt/Decrypt your messages"+NEUTRAL);
+ System.out.println(BLUE+" By @Chal13W1zz"+NEUTRAL);
+
+ while (running){
+
+ System.out.println("\n \nSelect an option \n -> Encrypt a message : 1 \n -> Decrypt a message : 2 \n -> Exit : 3 ");
+ Integer option = Integer.parseInt(myConsole.readLine(BLUE+"option"+GREEN+"@caesar:"+BLUE+"~$ "+NEUTRAL));
+
+
+ if(option == 1){
+ System.out.println("\nEnter the message to Encrypt : ");
+ String message = myConsole.readLine(BLUE+"message"+GREEN+"@caesar:"+BLUE+"~$ "+NEUTRAL);
+ System.out.println("\nEnter the shift key '1 - 25' :");
+ int key = Integer.parseInt(myConsole.readLine(BLUE+"key"+GREEN+"@caesar:"+BLUE+"~$ "+NEUTRAL));
+ myCaesar.setKey(key);
+ myCaesar.encrypt(message);
+ System.out.println(RED+"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"+NEUTRAL);
+ System.out.println(BLUE+"Input String: "+GREEN+message);
+ System.out.println(BLUE+"Encrypted String: "+GREEN+myCaesar.getEncryptedMsg());
+ System.out.println(BLUE+"Shift/Encryption key : "+GREEN+myCaesar.getKey()+NEUTRAL);
+ System.out.println(RED+"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"+NEUTRAL);
+
+ }else if(option == 2){
+ System.out.println("Enter the message to Decrypt : ");
+ String message = myConsole.readLine(BLUE+"encryptedMessage"+GREEN+"@caesar:"+BLUE+"~$ "+NEUTRAL);
+ System.out.println("\nEnter the shift key '1 - 25' :");
+ int key = Integer.parseInt(myConsole.readLine(BLUE+"key"+GREEN+"@caesar:"+BLUE+"~$ "+NEUTRAL));
+ myCaesar.setKey(key);
+ myCaesar.decrypt(message);
+ System.out.println(RED+"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"+NEUTRAL);
+ System.out.println(BLUE+"Input String: "+GREEN+message);
+ System.out.println(BLUE+"Decrypted String: "+GREEN+myCaesar.getDecryptedMsg());
+ System.out.println(BLUE+"Shift/Decryption key : "+GREEN+myCaesar.getKey()+NEUTRAL);
+ System.out.println(RED+"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"+NEUTRAL);
+
+ }else if(option == 3){
+ System.out.println(RED+"Goodbye :)");
+ running = false ;
+ }else {
+ System.out.println(RED+"Oops!, invalid Option :("+NEUTRAL);
+ }
+ }
+
+ //
+// int
+// CaesarShift encDec = new CaesarShift("Hello",25);
+// System.out.println("Input String: " + input);
+// System.out.println("Encrypted: " + encDec.encrypt(input));
+// System.out.println("Decrypted String: "+encDec.decrypt(encDec.encrypt(input)));
+ }
+}
diff --git a/src/main/java/CaesarShift.java b/src/main/java/CaesarShift.java
index e603113..f0600fe 100644
--- a/src/main/java/CaesarShift.java
+++ b/src/main/java/CaesarShift.java
@@ -2,21 +2,21 @@
public class CaesarShift {
private static final String ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //Encapsulate and make the alphabet immutable
- private static int key = 25; //Initialize and encapsulate the shift key
+ private static int key = 25; //Initialize and encapsulate the shift key
private static String encryptedMsg; //Create and encapsulate the message container
- private static String decryptedMsg;
+ private static String decryptedMsg; //Create and encapsulate the decrypted message container
- public String encrypt(String encryptMsg){
+ public String encrypt(String encryptMsg) {
String upCased = encryptMsg.toUpperCase();
char[] upCasedArrs = upCased.toCharArray();//split the string to a character array
ArrayList encryptedChars = new ArrayList();
//loop through the character array
- for(Character character : upCasedArrs ){
+ for (Character character : upCasedArrs) {
int index = ALPHABET.indexOf(character.toString());//get the character rank in the alphabet
- int encryptedCharIndex = Math.floorMod((index+key),26);//shift the character using the key and get the new characters rank in the alphabet
+ int encryptedCharIndex = Math.floorMod((index + key), 26);//shift the character using the key and get the new characters rank in the alphabet
encryptedChars.add(ALPHABET.charAt(encryptedCharIndex));//get the character from the alphabet rank and add it to the char array
- encryptedMsg = encryptedChars.toString().replaceAll("\\[|\\]|\\s","").replaceAll(",","");//convert and cleanup the char array to a string
+ encryptedMsg = encryptedChars.toString().replaceAll("\\[|\\]|\\s", "").replaceAll(",", "");//convert and cleanup the char array to a string
}
return encryptedMsg;
}
@@ -37,4 +37,20 @@ public String decrypt(String decryptMsg) {
}
+ public static int getKey() {
+ return key;
+ }
+
+ public static void setKey(int key) {
+ CaesarShift.key = key;
+ }
+
+ public static String getEncryptedMsg() {
+ return encryptedMsg;
+ }
+
+ public static String getDecryptedMsg() {
+ return decryptedMsg;
+ }
+
}