-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
218 additions
and
1,022 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/.metadata/ | ||
/.recommenders/ |
Binary file removed
BIN
-6.68 MB
.recommenders/index/http___download_eclipse_org_recommenders_models_oxygen_/_0.fdt
Binary file not shown.
Binary file removed
BIN
-110 KB
.recommenders/index/http___download_eclipse_org_recommenders_models_oxygen_/_0.fdx
Binary file not shown.
3 changes: 0 additions & 3 deletions
3
.recommenders/index/http___download_eclipse_org_recommenders_models_oxygen_/_0.fnm
This file was deleted.
Oops, something went wrong.
1,018 changes: 0 additions & 1,018 deletions
1,018
.recommenders/index/http___download_eclipse_org_recommenders_models_oxygen_/_0.frq
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
.recommenders/index/http___download_eclipse_org_recommenders_models_oxygen_/_0.nrm
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-177 KB
.recommenders/index/http___download_eclipse_org_recommenders_models_oxygen_/_0.prx
Binary file not shown.
Binary file removed
BIN
-26.5 KB
.recommenders/index/http___download_eclipse_org_recommenders_models_oxygen_/_0.tii
Binary file not shown.
Binary file removed
BIN
-1.59 MB
.recommenders/index/http___download_eclipse_org_recommenders_models_oxygen_/_0.tis
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
.recommenders/index/http___download_eclipse_org_recommenders_models_oxygen_/segments.gen
Binary file not shown.
Binary file removed
BIN
-244 Bytes
.recommenders/index/http___download_eclipse_org_recommenders_models_oxygen_/segments_1
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-10"> | ||
<attributes> | ||
<attribute name="module" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>ADFGVXCipher</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=10 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=10 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
z, | ||
y, | ||
n, | ||
q, | ||
t, | ||
9, | ||
5, | ||
r, | ||
x, | ||
e, | ||
g, | ||
l, | ||
f, | ||
p, | ||
4, | ||
h, | ||
1, | ||
b, | ||
j, | ||
c, | ||
6, | ||
7, | ||
d, | ||
m, | ||
s, | ||
v, | ||
u, | ||
o, | ||
2, | ||
3, | ||
a, | ||
i, | ||
k, | ||
w, | ||
8, | ||
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import java.io.IOException; | ||
import java.io.PrintWriter; | ||
import java.util.Scanner; | ||
|
||
public class ADFGVXCipher { | ||
|
||
public static void main(String[] args) throws IOException { | ||
int menuSelect; | ||
Chart codeChart = null; | ||
Scanner keyboard = new Scanner(System.in); | ||
PrintWriter chartFile = new PrintWriter("ENCRYPTCHART.txt"); | ||
String codeDigits = "", message, phrase, cipherText = "", newChart = "", chartFileLoc; | ||
boolean validInput = false; | ||
//encryption or decryption | ||
do { | ||
System.out.println("Would you like to\n1. Encrypt\n2. Decrypt\nPlease select option: "); | ||
menuSelect = keyboard.nextInt(); keyboard.nextLine(); | ||
} while(menuSelect != 1 && menuSelect != 2); | ||
//old chart or new chart? | ||
do { | ||
System.out.println("Are you creating a new chart?\n(Y/N): "); | ||
newChart = keyboard.nextLine(); | ||
if(newChart.toLowerCase().equals("y") || newChart.toLowerCase().equals("n")) | ||
validInput = true; | ||
} while(!validInput); | ||
do { | ||
System.out.println("Please enter the enciphering digits.\ne.g. ADFGX(5) or ADFGVX(6)\n"); | ||
codeDigits = keyboard.nextLine(); | ||
} while(codeDigits.length() < 5 || codeDigits.length() > 6); | ||
if(newChart.equals("y")) { | ||
//make new chart | ||
codeChart = new Chart(codeDigits); | ||
codeChart.ChartPrint(chartFile); | ||
chartFile.close(); | ||
} | ||
else { | ||
//get location of chart file, throw into constructor | ||
System.out.println("Please enter the path to chart file \n(If in root folder, just name without file extension)\n"); | ||
chartFileLoc = keyboard.nextLine(); chartFileLoc += ".txt"; | ||
//load chart from file, line by line | ||
} | ||
//save new chart to file to export | ||
|
||
//get message | ||
System.out.println("Please enter message: "); message = keyboard.nextLine(); | ||
System.out.println("Please the encryption phrase: "); phrase = keyboard.nextLine(); | ||
|
||
switch(menuSelect) { | ||
case 1: //encrypt | ||
cipherText = Encryption(message, phrase, codeChart); | ||
break; | ||
case 2: //decrypt | ||
break; | ||
} | ||
|
||
//System.out.print(codeDigits.charAt(0) == 65); | ||
System.out.printf("%s", cipherText); | ||
|
||
keyboard.close(); | ||
} | ||
|
||
public static String Encryption(String clearText, String secretPhrase, Chart codeChart) { | ||
String cipherText = "", sortedPhrase = ""; | ||
//strip whitespace | ||
clearText.replace(" ", ""); | ||
//get Cartesian coords | ||
for(int i = 0; i < clearText.length(); i++) | ||
cipherText += codeChart.CodeReturn(clearText.toLowerCase().charAt(i)); | ||
//perform phrase sorting | ||
|
||
|
||
|
||
return cipherText; | ||
} | ||
|
||
public static String Decryption(String cipherText, Chart codeChart) { | ||
String plainText = ""; | ||
|
||
|
||
return plainText; | ||
} | ||
|
||
private static String sortingMethod(String secretPhrase) { | ||
String sortedPhrase = ""; | ||
//sort - .toCharArray() | ||
|
||
return sortedPhrase; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import java.io.PrintWriter; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.Random; | ||
|
||
public class Chart { | ||
private int keySpace; | ||
private ArrayList<String> alphabet = new ArrayList<>(Arrays.asList("a","b","c","d","e","f","g","h","i","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","j","1","2","3","4","5","6","7","8","9","0")); | ||
private String[] chart; | ||
private Random rand = new Random(); | ||
private String codeDigits; | ||
|
||
public Chart(String codeDigits) { | ||
this.codeDigits = codeDigits; | ||
this.keySpace = this.codeDigits.length()*this.codeDigits.length(); | ||
this.chart = ChartMaker(); | ||
} | ||
|
||
public Chart(String codeDigits, String[] givenChart) { | ||
this.codeDigits = codeDigits; | ||
this.chart = givenChart; | ||
this.keySpace = (givenChart.length > 25 ? 36 : 25); | ||
} | ||
|
||
private String[] ChartMaker() { | ||
int spot; | ||
chart = new String[this.keySpace]; | ||
for(;this.keySpace < alphabet.size();) | ||
alphabet.remove(this.keySpace); | ||
|
||
//fill chart with letters | ||
for(int i = 0; i < chart.length; i++) { | ||
spot = rand.nextInt(alphabet.size()); | ||
chart[i] = alphabet.get(spot); | ||
alphabet.remove(spot); | ||
} | ||
return chart; | ||
} | ||
|
||
public void ChartPrint(PrintWriter outputFile) { | ||
for(int i = 0; i < chart.length; i++) | ||
outputFile.printf("%s%s", chart[i], (i == chart.length-1? "" : ",\n")); | ||
} | ||
|
||
public String CodeReturn(char letter) { | ||
String returnCode = ""; | ||
for(int i = 0; i < this.keySpace; i++) | ||
if(letter == chart[i].charAt(0)) | ||
returnCode = codeDigits.charAt(i%codeDigits.length()) + "" + codeDigits.charAt(i/codeDigits.length()); | ||
return returnCode; | ||
} | ||
} |