Question: Write a method which validates a password in JAVA. Then write a program in JAVA that prompts the user to enter a password (and verify
Write a method which validates a password in JAVA. Then write a program in JAVA that prompts the user to enter a password (and verify it). Your program will call your method to validate the password. Your method must check that the password strings match and contain at least 8 characters. Furthermore, the password must contain at least 1 special character (!,@,#,$,%,^,&,*,_,-), 1 number, 1 lower case, and 1 upper case letter.
Your validation method should print out a message for every violation that the password has.
Now that you have a working password checker, we will add some encryption so that you can be a little bit safer when storing user passwords. In this task, you are to create a method that implements a Caesar cipher. A Caesar cipher is an old and very insecure method of encryption. It involves shifting characters in order to create a new string. For example, if the input string is abc then the output string would be bcd (see that every character was shifted 1 position to the right). If we wanted to revert the encrypted string back to the original, we would simply shift it 1 to the left. The number of positions to shift is referred to as the key. So if the key is 3, then we would shift right 3 to encrypt and left 3 to decrypt.Create a method that takes three arguments: a String representing the plain text, an integerthat represents the key, and another integer that represents the mode (encrypt or decrypt). Here, mode is 0 for encryption and 1 for decryption. To make things easier, we will be dealing with ASCII characters from the range of decimal 33 to decimal 126. You can find the ASCII table here: http://www.asciitable.com/. This makes the size of our alphabet to be 126 - 33 = 93.
Cipher = E(PlainText) = (PlainText + key) mod alphabet_size
PlainText = D(Cipher) = (Cipher key) mod alphabet_size
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
