e55db081d05f58a

rotning.js

Dec 16th, 2021 (edited)
1,481
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //rot13.js :)
  2. /*
  3. var rot13=function(txt){;i=0;sr13='';while(i<txt.length){cr13=(txt[i].charCodeAt() >=65&&txt[i].charCodeAt() <=90)||(txt[i].charCodeAt()>=97&&txt[i].charCodeAt() <=122)?String.fromCharCode(txt[i].charCodeAt()+13):txt[i];if(cr13.charCodeAt()>90 && cr13.charCodeAt()<110)sr13+=String.fromCharCode(64+(cr13.charCodeAt())%90);else if(cr13.charCodeAt()>122 && cr13!=txt[i]) sr13+=String.fromCharCode(96+(cr13.charCodeAt())%122); else sr13+=cr13; i++;}return sr13;}
  4. */
  5. /*
  6. rot1.js
  7. ...
  8. ...
  9. rot13.js
  10. rot14.js
  11. rot15.js
  12. ...
  13. rotning.js :)
  14. */
  15.  
  16. var rotning=function(txt,m){if(m<0 || m>26 || m===undefined)m=13;i=0;sr13='';while(i<txt.length){cr13=(txt[i].charCodeAt() >=65&&txt[i].charCodeAt() <=90)||(txt[i].charCodeAt()>=97&&txt[i].charCodeAt() <=122)?String.fromCharCode(txt[i].charCodeAt()+m):txt[i];if(cr13.charCodeAt()>90 && cr13.charCodeAt()<(97+m))sr13+=String.fromCharCode(64+(cr13.charCodeAt())%90);else if(cr13.charCodeAt()>122 && cr13!=txt[i]) sr13+=String.fromCharCode(96+(cr13.charCodeAt())%122); else sr13+=cr13;i++;}return sr13;}
Add Comment
Please, Sign In to add comment