MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / decrypt

Function decrypt

assets/js/caesarCipher.js:26–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24}
25
26function decrypt() {
27 var input = "";
28 var input = document.getElementById("input").value;
29
30 if (input.length == 0) {
31 generateWarning("Please enter a string ");
32 }
33 else {
34 var key = parseInt(document.getElementById("key").value);
35 if (key >= 999999999 || key <= -9999999999) {
36 generateWarning("Enter Proper key");
37 }
38 var n_string = " ";
39
40 for (k = 0; k < input.length; k++) {
41
42 var x = input.charCodeAt(k) - key;
43
44 n_string += String.fromCharCode(x);
45
46 }
47
48 document.getElementById("output").innerHTML = "<center><b><u>After Decryption :</u></b></center><br>" + n_string;
49 }
50
51}
52function generateWarning(warningMessage) {
53 //To get the clicking sound
54 document.getElementById("click").play();

Callers

nothing calls this directly

Calls 1

generateWarningFunction · 0.85

Tested by

no test coverage detected