-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
3be6d50
commit a63c12f
Showing
36 changed files
with
1,622 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Core Programmer | ||
|
||
Developers Team | ||
|
||
::Developer:: | ||
HAROLD EDSEL F. CABALUNA <[email protected]> | ||
|
||
//A Lonely Programmer.. I want GF |
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,70 @@ | ||
package Encryption.Execute; | ||
|
||
import javax.naming.ContextNotEmptyException; | ||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public abstract class ExecuteDecryption extends ExecuteEncryption { | ||
protected static List<Integer> holdTheKey = new ArrayList<>(); | ||
public static List<String> holdTheInitials = new ArrayList<>(); | ||
public static List<String> finalOutputData = new ArrayList<>(); | ||
protected static Map<Integer, String> keyManipulation = new HashMap<>(); | ||
protected static Map<String, Integer> keyManipulationFirst = new HashMap<>(); | ||
|
||
public void decryptionStart(String plainText) { | ||
|
||
int[] dataPassing = { | ||
subA, subB, subC, subD, subE, subF, subG, subH, subI, | ||
subJ, subK, subL, subM, subN, subO, subP, subQ, subR, | ||
subS, subT, subU, subV, subW, subX, subY, subZ, One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Eleven, Twelve, Thirteen, | ||
Fourteen, Fifteen, Sixteen, Seventeen, Eighteen, Nineteen, Twenty, Twentyone, Twentytwo, Twentythree, Twentyfour, Twentyfive, | ||
Twentysix, Twentyseven, Twentyeight, Twentynine, Thirty, Thirtyone, Thirtytwo, Thirtythree, Thirtyfour, Thirtyfive, Thirtysix, Thirtyseven, | ||
Thirtyeight, Thirtynine, Forty, Fortyone, Fortytwo, Fortythree,Fortyfour,Fortyfive, Fortysix, Fortyseven, Fortyeight, Fortynine, Fifty | ||
,Fiftyone,Fiftytwo,Fiftythree,Fiftyfour,Fiftyfive,Fiftysix,Fiftyseven, Fiftyeight, Fiftynine, Sixty | ||
}; | ||
|
||
for (int x = 0; x < 26; x++) { | ||
holdTheKey.add(dataPassing[x]); | ||
} | ||
|
||
String[] alphabetsData = { | ||
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", | ||
"K", "L", "M", "N", "O", "P", "Q", "R", "S", | ||
"T", "U", "V", "W", "X", "Y", "Z", "~", "^", "[", "#", | ||
"@", "*", "%", "{", ":", "}", "<", ">", "|", "\\", | ||
"_", "]", "$", ";", "!", "=", "+", "-", "1", "2", | ||
"3", "4", "5", "6", "7", "8", "9", "0", "&", ".", | ||
",", "(", ")", "/", "\"", "'", "`", "?", | ||
"¢", "€", "¥", "^", "°", "§", "∆", "Π", "√", | ||
"•", "÷", "×", "©", "®", "™", "✓", "£", " ", | ||
}; | ||
|
||
for (int j = 0; j < alphabetsData.length; j++) { | ||
keyManipulation.put(dataPassing[j], alphabetsData[j]); | ||
keyManipulationFirst.put(alphabetsData[j], dataPassing[j]); | ||
} | ||
|
||
for (int k = 0; k < plainText.length(); k++) { | ||
holdTheInitials.add(String.valueOf(plainText.charAt(k))); | ||
} | ||
|
||
for (int i = 0; i < plainText.length(); i++) { | ||
String initial = holdTheInitials.get(i); | ||
if (keyManipulationFirst.containsKey(initial)) { | ||
int decryptionKey = keyManipulationFirst.get(initial); | ||
String decryptedChar = keyManipulation.get(decryptionKey); | ||
finalOutputData.add(decryptedChar); | ||
} /*else { | ||
// If the character is not in the decryption mapping, treat it as a regular character | ||
finalOutputData.add(initial); | ||
}*/ | ||
} | ||
} | ||
|
||
public static void clearData() { | ||
holdTheInitials.clear(); | ||
finalOutputData.clear(); | ||
} | ||
} |
146 changes: 146 additions & 0 deletions
146
src/main/java/Encryption/Execute/ExecuteEncryption.java
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,146 @@ | ||
package Encryption.Execute; | ||
|
||
import lombok.SneakyThrows; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Random; | ||
|
||
public abstract class ExecuteEncryption extends isValid { | ||
public static List<Integer> getEncryptedData() {return encryptedData;} | ||
public static List<Integer> encryptedData = new ArrayList<>(); | ||
public static int outputEnc; | ||
public static int subA, subB, subC, subD, subE, subF, subG, subH, subI, | ||
subJ, subK, subL, subM, subN, subO, subP, subQ, subR, | ||
subS, subT, subU, subV, subW, subX, subY, subZ, One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Eleven, Twelve, Thirteen, | ||
Fourteen, Fifteen, Sixteen, Seventeen, Eighteen, Nineteen, Twenty, Twentyone, Twentytwo, Twentythree, Twentyfour, Twentyfive, | ||
Twentysix, Twentyseven, Twentyeight, Twentynine, Thirty, Thirtyone, Thirtytwo, Thirtythree, Thirtyfour, Thirtyfive, Thirtysix, Thirtyseven, | ||
Thirtyeight, Thirtynine, Forty, Fortyone, Fortytwo, Fortythree,Fortyfour,Fortyfive, Fortysix, Fortyseven, Fortyeight, Fortynine, Fifty | ||
,Fiftyone,Fiftytwo,Fiftythree,Fiftyfour,Fiftyfive,Fiftysix,Fiftyseven, Fiftyeight, Fiftynine, Sixty | ||
; | ||
public static HashMap<String, Integer> encryptionData = new HashMap<>(); | ||
public static HashMap<char[], Integer> asciiValue = new HashMap<char[], Integer>(); | ||
|
||
public static String[] alphabetsData = | ||
{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", | ||
"K", "L", "M", "N", "O", "P", "Q", "R", "S", | ||
"T", "U", "V", "W", "X", "Y", "Z", "~", "^", "[", "#", | ||
"@", "*", "%", "{", ":", "}", "<", ">", "|", "\\", | ||
"_", "]", "$", ";", "!", "=", "+", "-", "1", "2", | ||
"3", "4", "5", "6", "7", "8", "9", "0", "&", ".", | ||
",", "(", ")", "/", "\"", "'", "`", "?", | ||
"¢", "€", "¥", "^", "°", "§", "∆", "Π", "√", | ||
"•", "÷", "×", "©", "®", "™", "✓", "£", " ",}; | ||
static List<String> dataStoring = new ArrayList<>(); | ||
|
||
int digitNumber; | ||
|
||
@SneakyThrows | ||
public void runEncryption(String plainText) { | ||
Random rand = new Random(); | ||
for (String alphabetsDatum : alphabetsData) { | ||
encryptionData.put(alphabetsDatum, rand.nextInt(10000) * rand.nextInt(20) - rand.nextInt(20)); | ||
} | ||
subA = encryptionData.get("A"); | ||
subB = encryptionData.get("B"); | ||
subC = encryptionData.get("C"); | ||
subD = encryptionData.get("D"); | ||
subE = encryptionData.get("E"); | ||
subF = encryptionData.get("F"); | ||
subG = encryptionData.get("G"); | ||
subH = encryptionData.get("H"); | ||
subI = encryptionData.get("I"); | ||
subJ = encryptionData.get("J"); | ||
subK = encryptionData.get("K"); | ||
subL = encryptionData.get("L"); | ||
subM = encryptionData.get("M"); | ||
subN = encryptionData.get("N"); | ||
subO = encryptionData.get("O"); | ||
subP = encryptionData.get("P"); | ||
subQ = encryptionData.get("Q"); | ||
subR = encryptionData.get("R"); | ||
subS = encryptionData.get("S"); | ||
subT = encryptionData.get("T"); | ||
subU = encryptionData.get("U"); | ||
subV = encryptionData.get("V"); | ||
subW = encryptionData.get("W"); | ||
subX = encryptionData.get("X"); | ||
subY = encryptionData.get("Y"); | ||
subZ = encryptionData.get("Z"); | ||
One = encryptionData.get("~"); | ||
Two = encryptionData.get("^"); | ||
Three = encryptionData.get("["); | ||
Four = encryptionData.get("#"); | ||
Five = encryptionData.get("@"); | ||
Six = encryptionData.get("*"); | ||
Seven = encryptionData.get("%"); | ||
Eight = encryptionData.get("{"); | ||
Nine = encryptionData.get(":"); | ||
Ten = encryptionData.get("}"); | ||
Eleven = encryptionData.get("<"); | ||
Twelve = encryptionData.get(">"); | ||
Thirteen = encryptionData.get("|"); | ||
Fourteen = encryptionData.get("\\"); | ||
Fifteen = encryptionData.get("_"); | ||
Sixteen = encryptionData.get("]"); | ||
Seventeen = encryptionData.get("$"); | ||
Eighteen = encryptionData.get(";"); | ||
Nineteen = encryptionData.get("!"); | ||
Twenty = encryptionData.get("="); | ||
Twentyone = encryptionData.get("+"); | ||
Twentytwo = encryptionData.get("-"); | ||
Twentythree = encryptionData.get("1"); | ||
Twentyfour = encryptionData.get("2"); | ||
Twentyfive = encryptionData.get("3"); | ||
Twentysix = encryptionData.get("4"); | ||
Twentyseven = encryptionData.get("5"); | ||
Twentyeight = encryptionData.get("6"); | ||
Twentynine = encryptionData.get("7"); | ||
Thirty = encryptionData.get("8"); | ||
Thirtyone = encryptionData.get("9"); | ||
Thirtytwo = encryptionData.get("0"); | ||
Thirtythree = encryptionData.get("&"); | ||
Thirtyfour = encryptionData.get("."); | ||
Thirtyfive = encryptionData.get(","); | ||
Thirtysix = encryptionData.get("("); | ||
Thirtyseven = encryptionData.get(")"); | ||
Thirtyeight = encryptionData.get("/"); | ||
Thirtynine = encryptionData.get("\\"); | ||
Forty = encryptionData.get("'"); | ||
Fortyone = encryptionData.get("`"); | ||
Fortytwo = encryptionData.get("?"); | ||
Fortythree = encryptionData.get("¢"); | ||
Fortyfour = encryptionData.get("€"); | ||
Fortyfive = encryptionData.get("¥"); | ||
Fortysix = encryptionData.get("^"); | ||
Fortyseven = encryptionData.get("°"); | ||
Fortyeight = encryptionData.get("§"); | ||
Fortynine = encryptionData.get("∆"); | ||
Fifty = encryptionData.get("Π"); | ||
Fiftyone = encryptionData.get("√"); | ||
Fiftytwo = encryptionData.get("•"); | ||
Fiftythree = encryptionData.get("÷"); | ||
Fiftyfour = encryptionData.get("×"); | ||
Fiftyfive = encryptionData.get("©"); | ||
Fiftysix = encryptionData.get("®"); | ||
Fiftyseven = encryptionData.get("™"); | ||
Fiftyeight = encryptionData.get("✓"); | ||
Fiftynine = encryptionData.get("£"); | ||
Sixty = encryptionData.get(" "); | ||
|
||
if (isValidEncryption(plainText)) { | ||
for (int x=0; x<plainText.length(); x++) { | ||
dataStoring.add(String.valueOf(plainText.charAt(x))); | ||
} | ||
for (String s : dataStoring) { | ||
outputEnc = encryptionData.get(s); | ||
encryptedData.add(outputEnc); | ||
} | ||
} | ||
} | ||
public static void clearingData() { | ||
dataStoring.clear(); | ||
encryptedData.clear(); | ||
} | ||
} |
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,45 @@ | ||
package Encryption.Execute; | ||
|
||
import Encryption.Interfaces.validating; | ||
import Exceptions.Calling.IllegalCharacters.IllegalCharacterException; | ||
import Exceptions.Calling.InvalidValueReference.InvalidValueReferenceException; | ||
import Exceptions.Calling.UnsupportedSymbols.SymbolNotSupportedException; | ||
import lombok.Getter; | ||
import lombok.SneakyThrows; | ||
|
||
import java.security.InvalidKeyException; | ||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
|
||
@Getter | ||
public class isValid implements validating { | ||
String firstException, secondException, thirdException; | ||
@SneakyThrows | ||
@Override | ||
public boolean isValidEncryption(String plainText) { | ||
for (int x = 0; x < plainText.length(); x++) { | ||
char data = plainText.charAt(x); | ||
|
||
/* if (Character.isLowerCase(data)) { | ||
firstException = (""" | ||
Exception in thread "AWT-EventQueue-0" Exceptions.Calling.IllegalCharacters\s | ||
IllegalCharacterException: Undefined Data at programmable.GuiVersion.WindowsofChoice\s | ||
isValidEncryption at programmable.GuiVersion.WindowsofChoice\s | ||
ActionPerformed at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased"""); | ||
throw new IllegalCharacterException("Undefined Data"); | ||
}*/ | ||
/*if (data == '1' || data == '2' || data == '3' || | ||
data == '4' || data == '5' || data == '6' || | ||
data == '7' || data == '8' || | ||
data == '9') { | ||
secondException = (""" | ||
Exception in Encryption Algorithm :From: \s[InvalidValueReferenceException] | ||
Exceptions.Calling.InvalidValueReference \s[InvalidValueReferenceException] | ||
Exception Occurred: \s[Encryption Must Be PlainText Only (No Numeric Data is Allowed!)]"""); | ||
throw new InvalidValueReferenceException("", new IllegalArgumentException()); | ||
}*/ | ||
} | ||
return true; | ||
} | ||
} |
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 @@ | ||
package Encryption.Interfaces; | ||
|
||
import lombok.SneakyThrows; | ||
|
||
public interface LoadingProgress { | ||
@SneakyThrows | ||
default void sleepWait() { | ||
Thread.sleep(500); | ||
} | ||
} |
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 @@ | ||
package Encryption.Interfaces; | ||
|
||
import lombok.SneakyThrows; | ||
|
||
public interface SleepWaiting { | ||
@SneakyThrows | ||
default void sleepWait() { | ||
Thread.sleep(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,6 @@ | ||
package Encryption.Interfaces; | ||
|
||
@FunctionalInterface | ||
public interface validating { | ||
boolean isValidEncryption(String plainText); | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/Exceptions/Calling/DataInconsistencyException/DataInconsistencyException.java
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,7 @@ | ||
package Exceptions.Calling.DataInconsistencyException; | ||
|
||
public class DataInconsistencyException extends IllegalThreadStateException{ | ||
DataInconsistencyException() {} | ||
DataInconsistencyException(String message) {super(message);} | ||
public DataInconsistencyException(Throwable cause) {super(String.valueOf(cause));} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/Exceptions/Calling/IllegalCharacters/IllegalCharacterException.java
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,8 @@ | ||
package Exceptions.Calling.IllegalCharacters; | ||
|
||
import java.util.InputMismatchException; | ||
|
||
public class IllegalCharacterException extends InputMismatchException { | ||
public IllegalCharacterException() {} | ||
public IllegalCharacterException(String message) {super(message);} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/Exceptions/Calling/IllegalDataSubmmitted/IllegalDataSubmittedException.java
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,8 @@ | ||
package Exceptions.Calling.IllegalDataSubmmitted; | ||
|
||
public class IllegalDataSubmittedException extends IllegalArgumentException { | ||
public IllegalDataSubmittedException() {} | ||
IllegalDataSubmittedException(String message) {super(message);} | ||
IllegalDataSubmittedException(Throwable cause) {super(cause);} | ||
public IllegalDataSubmittedException(String message, Throwable cause) {super(message, cause);} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/Exceptions/Calling/InvalidValueReference/InvalidValueReferenceException.java
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,8 @@ | ||
package Exceptions.Calling.InvalidValueReference; | ||
|
||
public class InvalidValueReferenceException extends IllegalArgumentException { | ||
public InvalidValueReferenceException() {} | ||
public InvalidValueReferenceException(String message) {super(message);} | ||
public InvalidValueReferenceException(Throwable cause) {super(cause);} | ||
public InvalidValueReferenceException(String message, Throwable cause) {super(message, cause);} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/Exceptions/Calling/UnsupportedSymbols/SymbolNotSupportedException.java
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 @@ | ||
package Exceptions.Calling.UnsupportedSymbols; | ||
|
||
|
||
import java.security.InvalidKeyException; | ||
|
||
public class SymbolNotSupportedException extends InvalidKeyException { | ||
public SymbolNotSupportedException(String message) {super(message);} | ||
public SymbolNotSupportedException(Throwable cause) {super(cause);} | ||
public SymbolNotSupportedException(String message, Throwable cause) {super(message, cause);} | ||
} |
Oops, something went wrong.