I need help creating Pseudocode for my Java Project For JAVA
I need help creating Pseudocode for my Java Project. For JAVA i need help with my project. here is it: As a security-minded professional, it is important that only the appropriate people gain access to data in your computer system. This is called authentication. Once users gain entry, it is also important that they only see data related to their role in the zoo. This is called authorization. You have been given a file of users and their credentials. Create an 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 in this document and follow the comments in it to perform this operation. Checks the credentials against the valid credentials provided in the file (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 You are allowed to add extra roles if you would like to see another type of user added to the system, but you may not remove any of the existing roles. User name and Pw for the code to dialong box: 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\"
Sorry!! Forgot to include 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
}
}
This may help as well to organize.
Zoo keeper file.
Veternarian file
System Admin file
Solution
import java.util.Scanner; class Password { public static void main(String[] args) { Scanner input = new Scanner(System.in); //------ENTER A USERNAME System.out.println(\"Welcome please enter your username and password.\"); System.out.print(\"Username >>\"); input.nextLine(); //------PASSWORD AUTHENTICATION BEGIN String password = enterPassword(); while ( !checkPassword(password) ) { System.out.println(\"Password must be 6 - 10 characters long!\"); password = enterPassword(); } //------PASSWORD VERIFY String passwordverify = enterPassword(); while (!password.equals(passwordverify)){ System.out.println(\"ERROR - Passwords DO NOT MATCH Re-Enter Passwords Again\"); password = enterPassword(); } //------ACCEPT PASSWORD System.out.println(\"Username and Password Accepted!\"); } //--ENTER PASSWORD STATEMENT public static String enterPassword(){ String password; Scanner input = new Scanner(System.in); System.out.print(\"Password >>\"); password = input.nextLine(); return password; } //--BOOLEAN CHECK PW public static boolean checkPassword(String password){ int length; length = password.length(); if (length < 6 || length > 11){ return false; } for (int i = 0; i < password.length();i++){ if (!Character.isLetter(password.charAt(i))) return false; } return true; } }
