Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

RUN THE CODE import java.security.MessageDigest; public class MD5Digest { public static void main(String[] args) throws Exception { //Copy and paste this section of code String

RUN THE CODE

import java.security.MessageDigest;

public class MD5Digest {

public static void main(String[] args) throws Exception {

//Copy and paste this section of code
String original = "letmein"; //Replace "password" with the actual password inputted by the user
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(original.getBytes());
byte[] digest = md.digest();
StringBuffer sb = new StringBuffer();
for (byte b : digest) {
sb.append(String.format("%02x", b & 0xff));
}
//End copy/paste

System.out.println("original:" + original);
System.out.println("digested:" + sb.toString()); //sb.toString() is what you'll need to compare password strings
}

}

RUN THE CODE ABOVE AND SEE THE OUPUT. NOTICE THERE IS A ORIGINAL AND DIGESTED VERSION OF THE PASSWORD. USE THE CODE ABOVE AS ONE OF THE JAVA CLASSES FOR THIS ASSIGNMENT.

Now your job is to create a basic Java (no GUI or SWING) authentication system that does ALL of the following:

· Asks a user for a username

· Asks a user for a password

· Converts the password using a message digest five (MD5) hash:

o It is not required that you write the MD5 from scratch. Use the code located above and follow the comments in it to perform this operation.

· Checks the credentials against the valid credentials provided in the file below (use the hashed passwords in the second column; the third column contains the actual passwords for testing)

· Limits failed attempts to three before notifying the user and exiting

· After successful authentication, uses the role in the credential file to display the correct system information loaded from the specific role file

· Allows a user to log out

· Stays on the credential screen until either a successful attempt has been made, three unsuccessful attempts have been made, or a user chooses to exit

Here is the file that contains the users and passwords for authentification. (use the hashed passwords in the second column; the third column contains the actual passwords for testing)

griffin.keyes 108de81c31bf9c622f76876b74e9285f "alphabet soup"

rosario.dawson 3e34baa4ee2ff767af8c120a496742b5 "animal doctor"

bernie.gorilla a584efafa8f9ea7fe5cf18442f32b07b "secret password"

donald.monkey 17b1b7d8a706696ed220bc414f729ad3 "M0nk3y business"

jerome.grizzlybear 3adea92111e6307f8f2aae4721e77900 "grizzly1234"

bruce.grizzlybear 0d107d09f5bbe40cade3de5c71e9e9b7 "letmein"

Step by Step Solution

3.30 Rating (159 Votes )

There are 3 Steps involved in it

Step: 1

Code import javaioBufferedReader import javaioFileReader import javaioIOException import javaioInputStreamReader import javasecurityMessageDigest impo... blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Ethics in Accounting A Decision Making Approach

Authors: Gordon Klein

1st edition

1118928334, 978-1118928332

More Books

Students explore these related Chemical Engineering questions

Question

Each byte is assigned a unique

Answered: 3 weeks ago

Question

what is double entry accounting

Answered: 3 weeks ago