Need a ROT47 JavaScript Implementation -
I have received the following code to decode a ROT13 string and it has been inserted into a webpage with javascript:
& lt; Script type = "text / javascript" & gt; document.write ( "string" .replace (/ [a-zA-Z] / g, function (c) {String.fromCharCode ((c & lt return; = "Z" 90: 122) & gt; = ( C = c .charCodeAt (0) +13) c: C6);})); & Lt; / Script & gt;
I need a similar JavaScript code to decode rotate.
I get some functions, but I do not know how to get it in the same script, so it
Can anyone please help?
Thanks a lot!
/ div>
Just copy the necessary actions into your javascript. At the appropriate place,
& lt; Script type = "text / javascript" & gt; Document.write (ROT47 ("string")); & Lt; / Script & gt;
Required functions:
// // ROTn.js - ROT13 and ROT47 to apply JavaScript code to ROT13 and ROT4. Useful for // Email address and telephone numbers from curious site crawlers // // usage: // & lt; Script type = "text / javascript" & gt; // ROT13 ( '& lt; n uers = "znvygb: vasb@ivfhnypb.qr" & gt; vasb@ivfhnypb.qr< / N & gt;'); // & lt; / Script & gt; // // resources: // http://de.wikipedia.org/wiki/ROT13 // http://www.drweb.de/magazin/codieren-und-verschlusseln-mit-javascript/ // /// ///////////////////////////////////////////// // (C) 2010 Andreas Spindler use, copy, modify, and distribute / software and its documentation without any charges for the purpose or approved by // it without source code redistribution of the above // copyright notice and the following Disclaimer should be maintained. // // the software has been provided "as is" and the author rejects all warranties // Regardless of the // merchandise and suitability of this software, including all implied warranties. In any event the author any / special, direct, indirect, or consequential damages or shall not be liable for any loss // use, data or resulting from loss of profit, which action / inhibition / other Tortes use of this software Or connection with execution / out of operation / connection // // $ Raitstamp: 2010-06-09 13: 07: 07 maintained $ $ $: $ Wwwkvisualcokde function ROTn (text, map) keycode VAR map {// generic Ro-N algorithm R = new string () i, j, c, lane = map.length (i = 0; i & lt; text.length; i ++) {c = text.charAt (i) j = map.indexOf () C) If (h> = 0) {c = map.charAt ((J + lane / 2)% lane}} R = R + C} return R; } The function hides all ASCII characters 126 ("~") from the ROT47 (text) {// 33 ("!") So it can be used to obscure a text literally including the URL and email. = new string () R = ROTn (text, # $% & amp; '() * +, - / 0123456789 "\":.?; & lt; = & gt; @ ABCDEFGHIJKLMNOPQRSTUVWXYZ [\\] ^ _ `abcdefghijklmnopqrstuvwxyz {|} ~ ") Returns R;}
Comments
Post a Comment