Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A common security method used for online banking is to ask the user for three ra

ID: 3578123 • Letter: A

Question

A common security method used for online banking is to ask the user for three random characters from a passcode. For example, if the passcode was 531278, they may ask for the 2nd, 3rd, and 5th characters; the expected reply would be: 317.

The text file, keylog.txt, contains fifty successful login attempts.

Given that the three characters are always asked for in order, analyse the file so as to determine the shortest possible secret passcode of unknown length.

The text file contains:

319
680
180
690
129
620
762
689
762
318
368
710
720
710
629
168
160
689
716
731
736
729
316
729
729
710
769
290
719
680
318
389
162
289
162
718
729
319
790
680
890
362
319
760
316
729
380
319
728
716

___________________Answer is: 73162890" " I am trying to figure out how to code it by reading the text file into the program. using Java Netbeans.

Explanation / Answer

this is the code as per your requirement

public class checker {
public static void main(String args[]) {
String temp[] = { “319”, “680”, “180”, “690”, “129”, “620”, “762”, “689”, “762”, “318”, “368”, “710”, “720”,
“710”, “629”, “168”, “160”, “689”, “716”, “731”, “736”, “729”, “316”, “729”, “729”, “710”, “769”, “290”,
“719”, “680”, “318”, “389”, “162”, “289”, “162”, “718”, “729”, “319”, “790”, “680”, “890”, “362”, “319”,
“760”, “316”, “729”, “380”, “319”, “728”, “716” };
StringBuffer tempPassWord = new StringBuffer(temp[0]);
for (int countLogs = 0; countLogs -1; count–) {
if (!(tempPassWord + “”).contains(temp[countLogs].charAt(count) + “”) && count == 2) {
tempPassWord = tempPassWord.append(temp[countLogs].charAt(count) + “”);
} else if (!(tempPassWord + “”).contains(temp[countLogs].charAt(count) + “”)) {
tempPassWord = tempPassWord.insert(tempPassWord.indexOf(temp[countLogs].charAt(count + 1) + “”),
temp[countLogs].charAt(count));
}
}
for (int count = 0; count tempPassWord
.indexOf(String.valueOf(temp[countLogs].charAt(count + 1)))) {
int index1 = tempPassWord.indexOf(String.valueOf(temp[countLogs].charAt(count)));
int index2 = tempPassWord.indexOf(String.valueOf(temp[countLogs].charAt(count + 1)));
tempChar = temp[countLogs].charAt(count);
tempPassWord.replace(index1, index1 + 1, String.valueOf(temp[countLogs].charAt(count + 1)));
tempPassWord.replace(index2, index2 + 1, tempChar + “”);
}
}
}
System.out.println((tempPassWord + “”));
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote