caesars cipher javascript

Solutions on MaxInterview for caesars cipher javascript by the best coders in the world

showing results for - "caesars cipher javascript"
Beatrice
19 Oct 2019
1function rot13(str) {
2var charcode = [];
3var words = [];
4
5for(let i = 0; i < str.length; i++){
6  
7  var asc = str.charCodeAt(i)
8  
9  charcode.push(asc)
10}
11var converted = charcode.map(function(a){
12  return a-13
13})
14console.log(converted)
15converted.forEach((letter)=>{
16 if(letter >= 65){
17  var final =String.fromCharCode(letter)
18  words.push(final)
19 }
20 else if(letter>=52){
21   final = String.fromCharCode(letter+26)
22   words.push(final)
23 }
24 else {
25   final = String.fromCharCode(letter+13)
26   words.push(final)
27 }
28 
29})
30return words.join("")
31}
32
33console.log(rot13("SERR YBIR?"));
Sebastián
22 Nov 2016
1   var myCipher = [];
2      var myArray = []; 
3      
4      for (i=0; i < str.length; i++) {
5        // convert character - or don't if it's a punctuation mark.  Ignore spaces.
6        if (str.charCodeAt(i) > 64 && str.charCodeAt(i) < 78) {
7             myArray.push(String.fromCharCode(str.charCodeAt(i) + 13));
8         } else if (str.charCodeAt(i) > 77 && str.charCodeAt(i) < 91) { 
9             myArray.push(String.fromCharCode(77 - (90 - str.charCodeAt(i))));
10         } else if (str.charCodeAt(i) > 32 && str.charCodeAt(i) < 65) {
11             myArray.push(str.charAt(i));
12         }
13       
14        // push word onto array when encountering a space or reaching the end of the string
15        
16        if (str.charCodeAt(i) == 32) {
17          myCipher.push(myArray.join(''));
18          myArray.length = 0;      
19        }
20        
21        if (i == (str.length - 1)) {
22           myCipher.push(myArray.join(''));
23        }
24
25      }
26
27      return myCipher.join(" ");
28      
29    }
queries leading to this page
cesar cipher jscaesar cipher using array javascripta caesar cypher with a function in javascriptjs caesar shift codecaesar cipher javascript casescaesar cipher javascript code solutioncaesar cipher function in javascriptcipher decipher javascriptcaesar cipher java script caesars cipher en jscaesar cipher javascript case insensitivejavascript how to write a ceaser cipher step by stepcreate a caesar cypher that encrypts a string in javascripthow to solve cipher javascriptatbash cipher javascript algorithmcaesar cipher encryption jscaesar function jscaesars cipher in javascriptcaesar cipher en jsceasars cipher jscaesar cipher and password encryption 2fdecryption jsencrypting a string using caesar cipher in javascriptjavascript how to write a caesar cipher step by stepjs caesar cipher numberscaesar cipher solver jscaesars cipher in jscaesar cipher technique in jsjavascript how to write a ceaser cipherjavascript caesar ciphercaesar cypher using javascriptcaesar cipher encryption javascriptcaesars cipher javascript projectcaesar cipher js codecaesars cipher jscaesar cipher javascriptcaesar cypher javascriptcaeser cipher javascriptcaesar cipher javascript gcipher in javascriptjs caesar cipher functioncaesar cipher jsdecryption caesar cipher javascriptcaesar chipher jscaesar cipher decoder javascriptjavascript cipher stringcaesar cipher js encrypt and decrypt codehow to create ceasar cipher javascriptcaesar cipher code in javascriptcaesar jsjs cesar encryptioncaesar cipher using array in javascripthow to make a cipher in javascripthow to do caesar cipher javascriptcaesar shift decoder javascriptjavascript caesar cipher examplescaesar shift javascriptcaesar javascript problemceaser cipher javascriptcaesar shift decode javascripthow do dechipher ceasar cipher jscaesar cipher using javascriptcaesar cipher encrypter code jscaesar 27s cypher that checks upper and lowercase letters jscaesar cypher jshow to make a caesar cipher in javascriptcesar cipher function jscaesars cypher javascript with casesimple javascript caesar ciphercaesar cipher javascript javascript the caesar 28 29 function in the src 2fcaesar jsencode caesar javascriptjavascript ciphercaesars cipher javascriptjavascript ceaser cipherjavascript ceasers cipherjs caesar cipherjs caesar cipher explainedhow to code a caesar cipher in javascriptcesar encryption in javascriptjs ceaser ciphercaesar cipher javascript codecaesar code javascriptcaesar cipher decrypt using array in javascriptcipher caesar in node jscaesar encryption jscaesars cipher javascript algorithmcaesar cipher encryption and decryption in javascriptshift cipher code in javascriptceasar cipher javascriptcaesar encryption in javascriptcipher string jscaesar cipher algorithm javascriptcaesar cipher javascript asciijs ceaser codecaesar encoding javascriptcipher string in jscaesar code jscaeser cipher js javascript how to caesar cipher decodecaesar cipher javascript keeps numberscesarcipher javascriptcaesar cipher node jsprogram caesar cipher javascriptcaesar cipher program in jscaesar cipher in javascriptceasars shift javascriptcaesar ciphe jscaesar cipher technique in jscaesar cipher javascript logic explainedcaesars cipher javascript