Skip to content

Commit

Permalink
Merge pull request #11 from mariasoria/JAVA-P0063-replace-new-string-…
Browse files Browse the repository at this point in the history
…calls

#4 (JAVA-P0063) Replace calls to String constructor with quotes
  • Loading branch information
VerisimilitudeX authored Oct 12, 2024
2 parents b0df2e1 + c1b8ac7 commit 7e0e8ba
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/VigenereBreaker.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class VigenereBreaker {

public String sliceString(String message, int whichSlice, int totalSlices) {
StringBuilder slicing = new StringBuilder(message);
String result = new String();
String result = "";
for (int k = whichSlice; k < slicing.length(); k += totalSlices) {
result += slicing.charAt(k);
}
Expand Down Expand Up @@ -47,8 +47,8 @@ public String breakForLanguage(String encrypted, HashSet<String> dict) {
int max = 0;
ArrayList<Integer> keyReturn = new ArrayList<Integer>(100);
int KeyLength = 0;
String aMessage = new String();
String largestDecryption = new String();
String aMessage;
String largestDecryption = "";
for (int klength = 1; klength < 100; klength++) {
keyReturn = tryKeyLength(encrypted, klength, 'e');
VigenereCipher VCipher = new VigenereCipher(keyReturn);
Expand All @@ -68,8 +68,8 @@ public String breakForLanguage(String encrypted, HashSet<String> dict) {
public String breakForLanguageQuizz(String encrypted, HashSet<String> dict) {
int max = 0;
ArrayList<Integer> keyReturn = new ArrayList<Integer>(100);
String aMessage = new String();
String largestDecryption = new String();
String aMessage;
String largestDecryption = "";
keyReturn = tryKeyLength(encrypted, 38, 'e');
VigenereCipher VCipher = new VigenereCipher(keyReturn);
aMessage = VCipher.decrypt(encrypted);
Expand All @@ -83,7 +83,7 @@ public String breakForLanguageQuizz(String encrypted, HashSet<String> dict) {
}

public String breakVigenere() {
String MaxDecryption = new String();
String MaxDecryption;
FileResource resource = new FileResource("assets/messages/secretmessage5.txt");
String message = resource.asString();
HashSet<String> DictContent = new HashSet<String>();
Expand Down

0 comments on commit 7e0e8ba

Please sign in to comment.