diff --git a/Ciphers/keyFinder.js b/Ciphers/keyFinder.js index 8dda33c3e7..f02171d493 100644 --- a/Ciphers/keyFinder.js +++ b/Ciphers/keyFinder.js @@ -3,25 +3,155 @@ Find and retrieve the encryption key automatically Note: This is a draft version, please help to modify, Thanks! ******************************************************/ function keyFinder(str){ // str is used to get the input of encrypted string - var key = 0; // return zero means the key can not be found - var wordbank =["is","Is","am","Am","are","Are","have","Have","has","Has","may","May","be","Be"]; - //var shiftNum = 0; //count the number of key shifted - var inStr = str.toString(); //convert the input to String - var outStr = ""; // store the output value - var wordInOutStr = ""; // temporary store the word inside the outStr, it is used for comparison - //document.getElementById("debug").innerHTML = shiftNum; // debug: display the shifted number(s) - for (var i=0; i<(52); i++){ //try the number of key shifted, the sum of character from a-z and A-Z is 26*2=52 - outStr = caesarCipherEncodeAndDecodeEngine(inStr,i); // use the encrytpion engine to decrypt the input string, shiftNum=i - for ( var i=0; i=48 && charCode<=57)) + { + if ( shftedcharCode < 48 ){ + + let diff = Math.abs(48-1-shftedcharCode)%10; + + while( diff >= 10){ + diff = diff%10; + } + document.getElementById("diffID").innerHTML = diff; + + shftedcharCode = 57-diff; + + result = shftedcharCode; + } + + else if ( shftedcharCode>=48 && shftedcharCode<=57 ){ + result = shftedcharCode; + } + + else if ( shftedcharCode > 57 ){ + + let diff = Math.abs(57+1-shftedcharCode)%10; + + while( diff >= 10){ + diff = diff%10; + } + document.getElementById("diffID").innerHTML = diff; + + shftedcharCode = 48+diff; + + result = shftedcharCode; + } + + + } + + else if ( (charCode>=65 && charCode<=90) ) + { + + if (shftedcharCode <=64 ){ + + let diff = Math.abs(65-1-shftedcharCode)%26; + + while( (diff%26) >= 26){ + diff = diff%26; + } + shftedcharCode = 90-diff; + result = shftedcharCode; + } + + else if ( shftedcharCode>=65 && shftedcharCode<=90 ){ + result = shftedcharCode; + } + + else if (shftedcharCode>90 ){ + let diff = Math.abs(shftedcharCode-1-90)%26; + + while( (diff%26) >= 26){ + diff = diff%26; + } + shftedcharCode = 65+diff; + result = shftedcharCode; + } + + } + + else if ( (charCode>=97 && charCode<=122)) + { + if ( shftedcharCode<=96 ){ + + let diff = Math.abs(97-1-shftedcharCode)%26; + + while( (diff%26) >= 26){ + diff = diff%26; + } + shftedcharCode = 122-diff; + result = shftedcharCode; + } + + else if ( shftedcharCode>=97 && shftedcharCode<=122 ){ + result = shftedcharCode; + } + + else if (shftedcharCode>122 ){ + let diff = Math.abs(shftedcharCode-1-122)%26; + + while( (diff%26) >= 26){ + diff = diff%26; + } + shftedcharCode = 97+diff; + result = shftedcharCode; } + } + outStr = outStr + String.fromCharCode(parseInt(result)); } - return key; + return outStr; } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy