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

Write in Java a program for the following situation - Traditional password entry

ID: 657527 • Letter: W

Question

Write in Java a program for the following situation - Traditional password entry schemes are susceptile to "shoulder surfing" in which an attacker watches an unsuspecting user enter their password or PIN number and uses it later to gain access to the account. One way to combat this problem is with a randomized challenge-response system. In these systems the user enters different information every time based on a secret in response to a randomly generated challege. Consider the following scheme in which the password consists of a five-digit PIN number that is 1,2, or 3. The user enters the random numbers that correspond to their PIN instead of their actual PIN numbers. FOR example an actual pin number of 12345. To authenticate the user would be presented with the screen PIN: 0 1 2 3 4 5 6 7 8 9 NUM: 3 2 3 1 1 3 2 2 1 3 The user should enter 23113 instead of 12345. The next time user logs in a different sequence of random numbers would be generated for example PIN: 0 1 2 3 4 5 6 7 8 9 NUM: 1 1 2 3 1 2 2 3 3 3 Program should simulate the authentication process. Store an actual PIN number in your program. The program should use an array to assign random numbers to the digits from 0 to 9. Output the random digits to the screen, input the response from the user, and output whether or not the user's response correctly matches the PIN number.

Explanation / Answer

import java.util.Scanner; public class Authenticate { public static void main(String[] args) { // Actual password is 99508 int[] actual_password = {9, 9, 5, 0, 8}; // Array to hold randomly generated digits int[] random_nums = new int[10]; // Array to hold the digits entered by the user to authenticate int[] entered_digits = new int[actual_password.length]; // Randomly generate numbers from 1-3 for // for each digit for (int i=0; i < 10; i++) { random_nums[i] = (int) (Math.random() * 3) + 1; } // Output the challenge System.out.println("Welcome! To log in, enter the random digits from 1-3 that"); System.out.println("correspond to your PIN number."); System.out.println(); System.out.println("PIN digit: 0 1 2 3 4 5 6 7 8 9"); System.out.print("Random #: "); for (int i=0; i
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