You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I added in the AlphaNumeric encryption which is inthe Encrypt.java class. Hopefully I will be able to get an Java GUI for at least the ceaser cypher released soon. This update is for the first initial release. I know I jumped through a lot of numbers but considering where this program is at now, it feels like an full release for an console program.
Copy file name to clipboardExpand all lines: Main.java
+53-11Lines changed: 53 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,13 @@
1
1
packagebase;
2
2
importjava.util.Scanner;
3
-
importjava.util.Random;
4
3
5
4
publicclassMain {
6
5
7
6
8
7
publicstaticvoidmain(String[] args) {
8
+
9
+
//Start the object e for AlphaNum encryptions
10
+
Encrypte = newEncrypt();
9
11
10
12
// create a new scanner with the specified String Object
11
13
Scannerscanner = newScanner(System.in);
@@ -24,8 +26,8 @@ public static void main(String[] args) {
24
26
Scannerscanner1 = newScanner(System.in);
25
27
26
28
//Check how the user wants to encrypt
27
-
System.out.println("How Would You Like to Encrypt? - Available Currently: Ceaser Cypher");
28
-
System.out.println("For Ceaser Cypher, enter Ceaser"); //More would be added in as more encryption ways are added into the program
29
+
System.out.println("How Would You Like to Encrypt? - Available Currently: Ceaser Cypher, Alpha Number Encryption");
30
+
System.out.println("For Ceaser Cypher, enter Ceaser, For Alpha Number, enter AlphaNum"); //More would be added in as more encryption ways are added into the program
29
31
30
32
StringhowE = scanner.next();
31
33
@@ -34,29 +36,49 @@ public static void main(String[] args) {
34
36
System.out.println("What is the text you would like to encrypt?");
35
37
StringtextE = scanner1.next();
36
38
37
-
System.out.println("What is the offset for the Ceaser Cypher?");
39
+
System.out.println("What is the offset for the Ceaser Cypher? Enter 0 for an random offset");
38
40
StringnumE = scanner1.next();
39
41
40
42
intnumEi = Integer.parseInt(numE);
41
43
44
+
if (numEi == 0) {
45
+
Ranr = newRan();
46
+
numEi = r.ran();
47
+
}
48
+
42
49
Stringencrypted = Encrypter.encode(textE, numEi);
43
50
44
-
System.out.println("Below is encrypted Text with Ceaser Cypher, offset of " + numE);
51
+
System.out.println("Below is encrypted Text with Ceaser Cypher, offset of " + numEi);
45
52
System.out.println(encrypted);
46
53
54
+
System.out.println("please reload the application again if you want to do another calculation");
55
+
47
56
// close the scanner
48
57
scanner1.close();
49
58
50
-
scanner.close();
51
59
60
+
} elseif (howE.equals("AlphaNum")) {
61
+
62
+
63
+
System.out.println("Please enter the message to encrypt with NO SYMBOLS(symbols will look weird afterwards) :");
64
+
Strings = scanner1.nextLine();
65
+
66
+
System.out.println("How much do you want to multiply the encryption (The bigger the better but slower) NO DECIMALS");
67
+
StringnumS = scanner1.nextLine();
68
+
intnum = Integer.parseInt(numS);
69
+
70
+
e.encryptM(s, num);
71
+
72
+
52
73
}
74
+
53
75
} elseif (EorD.equals("Decrypt")){
54
76
55
77
System.out.println("Decrypting message");
56
78
57
79
//Asks the user how they want to decrypt
58
-
System.out.println("How Would You Like to Decrypt? - Available Currently: Ceaser Cypher");
59
-
System.out.println("For Ceaser Cypher, enter Ceaser"); //More would be added in as more encryption ways are added into the program
80
+
System.out.println("How Would You Like to Decrypt? - Available Currently: Ceaser Cypher, Alpha Numeric");
81
+
System.out.println("For Ceaser Cypher, enter Ceaser. For Alpha Numeric, enter AlphaNum"); //More would be added in as more encryption ways are added into the program
60
82
StringhowD = scanner.next();
61
83
62
84
if(howD.equals("Ceaser")) {
@@ -74,15 +96,35 @@ public static void main(String[] args) {
0 commit comments