Java Lab 11
Java Lab 11
Create a new Java file (empty Java file), save it to your H: drive, call it lab11
Insert the following code to set up your program:
Be sure to copy the test text files to the location where you saved your Java file
import java.util.Scanner;
import java.io.*;
commonPasswords.close();
stolenFile.close();
100pt:
Create a program that will read in all of the information in the file lab11pt1.txt and store it in a
String array of size 20.
This first file contains a list of common password hashes. Use the information stored in this
array to search through lab11pt2.txt, which contains a leaked list of usernames and passwords
from a website. Print out the username and the hash of any matches that you find.
Notes:
Username1,hashedpassword
Username2,hashedpassword2
Use the String split() method to store these in an array as you read through the file. Notes:
Create a String array:
String split():
String comparisons:
if(splitLine[1].equals(passwordArray[0]){
// Do Something
Use the following while loop to read in the file, line by line:
while(fileInput.hasNextLine()){