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

*** MIPS coding question *** Usually, the password, stored in Active Directory (

ID: 3739575 • Letter: #

Question

*** MIPS coding question ***

Usually, the password, stored in Active Directory (https://en.wikipedia.org/wiki/Active_Directory), is further encrypted using a built-in encryption algorithm.

To simplify the task, suppose the computer replaces the digits/characters throughout the password for other digits/characters with the letter three positions later in the alphabet.

For example:

Case 1: original password "012789" --> new password "345012"

Case 2: original password "abcxyz" --> new password "defabc"

Case 3: original password "012xyz" --> new password "345abc"

In this project, please "mimic" this encryption algorithm and encrypt a user input password using the previously mentioned approach. Then, please print out the encrypted password on the console.

Explanation / Answer

/* This types of problems are called Caesar Shift problems. Here is a Java program to do this shift. You can change the "shiftBy" variable to "shift" by any number. */ import java.util.Scanner; class CaesarShift { public static void main(String[] args) { System.out.print("Please enter your password: "); Scanner scanner = new Scanner(System.in); String password = scanner.nextLine(); int shiftBy = 3; String encryptedPassword = encrypt(password, shiftBy); System.out.println("Your encrypted password is " + encryptedPassword); } private static String encrypt(String password, int shift) { int capitalAStartCode = 65; int smallAStartCode = 97; int numbersStartCode = 48; StringBuilder result = new StringBuilder(); for (int i = 0; i