Question: CODE HAS TO BE IN JAVA Programming Project - Passwords & Cryptography For this project, you will complete a Java program that performs two types

CODE HAS TO BE IN JAVA

Programming Project - Passwords & Cryptography

For this project, you will complete a Java program that performs two types of password checking. You will use loops with string operations in both parts.

Submit your code & this document separately on Canvas.

Project Description

Create a Java class called Secrets

Add a comment at the top of your code file with your name, course name & section, and todays date (the format for this is up to you, but be clear & consistent)

Create a constant called PASSWORD_HASH that has 883 as the value (this corresponds to the string password, which will be the horrible password we have chosen for this assignment)

Create a constant called SHIFT with a value of 12

PART 1 Hashing a password: It is poor practice to save passwords, even if they are encrypted. A better idea is to store what is called a hash, a value calculated from the entered password that represents the password. There are many complicated schemes for calculating a hash, but we will create a simple hash that adds the numeric values of the individual characters in the password string.

Prompt the user for a password

Add the numeric values of the individual characters and compare it to the characters in the password

Report to the user whether they entered the correct password by comparing the hash calculated from the password they entered

PART 2 Encrypting a string: A simple form of encryption is called a Caesar cyper where each letter in an input is shifted by a constant amount to encrypt a string. You then decrypt the string by subtracting a constant amount from the encrypted string.

If the user entered the correct password, prompt them for a sentence.

Encrypt the entered string with a Caesar cypher as follows:

Get the numeric value of each character of the entered sentence (use the Integer.valueOf method)

Add the SHIFT value to the numeric value

Add the character with the resulting numeric value to a new string

Display the encrypted string

When you are done, delete the project description & sample output and fill in the boxes below

Note that the specific design is up to you, but you must have at least one switch for when you determine the winner.

How long did you spend working on this project?

Was there any part of the project that you found particularly difficult?

Does your code work? If not, explain what is wrong. If so, copy your output as text below:

Copy the part of the code where you declare the two constants in the box below

Copy the loop from part 1 where calculate the hash of the password in the box below

Copy the loop from part 2 where you perform the encryption in the box below

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!