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

Write a javasprit program called crypto.js that encrypts passwords containing up

ID: 3800567 • Letter: W

Question

Write a javasprit program called crypto.js that encrypts passwords containing uppercase/lowercase characters, digits, and special characters. Use Pizza2Day! For the password. See Sample Execution Below: This program will encrypt user passwords. Password: Pizza2Day! here is the code I wrote that has to run in console.log() in the program atom var pass = "Pizza2Day!"; var flag = 0; var encryptPass=""; var originalValues = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']; var encryptedValues = ['m', 'h', 't', 'f', 'g', 'k', 'b', 'p', 'j', 'w', 'e', 'r', 'q', 's', 'l', 'n', 'i', 'u', 'o', 'x', 'z', 'y', 'v', 'd', 'c', 'a']; function crypto(){ for(var i=0; i

Explanation / Answer

function crypto() {
var pass = "Pizza2Day!"
var key = "SXGWLZPDOKFIVUHJYTQBNMACERxswgzldpkoifuvjhtybqmncare";// this is the sequence you want to replace ABCD... with

pass = pass.toUpperCase().replace(/^s+|s+$/g, "");
var encyptedPass = "";
var chr;
for (var i = pass.length - 1; i >= 0; i--) {
chr = pass.charCodeAt(i);
encyptedPass += (chr >= 65 && chr <= 90) ?
key.charAt(chr - 65 + 26 * Math.floor(Math.random() * 2)) :
String.fromCharCode(chr);
}
return encyptedPass;
}

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