Everything2
Near Matches
Ignore Exact
Full Text
Everything2

ROT13

created by trak3r

(thing) by N-Wing (3.3 d) (print)   ?   I like it! Wed Jan 26 2000 at 6:26:44

For those of you too lazy to figure out what trak3r wrote, here is that writeup after going through ROT13:

ROT13 is a super lame encryption technique that consists of shifting each letter of the alphabet thirteen places. (uvag: guvf nccneragyl-tneoyrq fragrapr vf EBG13 rapbqrq)

For those people who don't have access to tr but have access to perl and the command line, here is a short little Perl program:

while(<>) {                   #for each line of data ...
    tr/a-zA-Z/n-za-mN-ZA-M/;  #... perform ROT-13 ...
    print;                    #... and display the translated line
}

dafydd, being a real Perl programmer, determined how to make the program a one-liner:

    tr/a-zA-Z/n-za-mN-ZA-M/ and print while <>

If you can't even do that, but have access to the site Everything 2 (probably a safe bet), JayBonci wrote E2 Rot13 Encoder, which lets E2 do all the work..


(thing) by Xamot (8.3 mon) (print)   ?   I like it! Wed Jan 26 2000 at 6:35:13

Just because I had most of this from my Caesar shift cipher node.
Plain    a b c d e f g h i j k l m n o p q r s t u v w x y z
ROT13    N O P Q R S T U V W X Y Z A B C D E F G H I J K L M
Or this might be simpler:
a b c d e f g h i j k l m
| | | | | | | | | | | | |
n o p q r s t u v w x y z

(thing) by daglo (1.7 y) (print)   ?   1 C! I like it! Thu Mar 16 2000 at 17:12:09

Here are two ways to solve your ROT-13 needs.
Use the following bookmarklet:

javascript:P9 = prompt( 'Text...', '' );

if ( P9 ) {
    S2b = '';

    for ( J7 = 0; J7 < P9.length; J7++ ) {
        C6 = P9.charCodeAt( J7 );

        if ( Math.abs( 16 - Math.abs( C6 - 93.5 ) ) <= 13 ) {
            W8b = ( C6 < 91 ) ? 65 : 97;
            S2b += String.fromCharCode(((C6 - W8b + 13) % 26 ) + W8b);
        } else {
            S2b += P9.charAt( J7 );
        }
    }

    alert( S2b );
} else {
    void ( null );
}


or use the magical perl y/a-zA-Z/n-za-mN-ZA-M/

(idea) by Tosta Dojen (3.4 y) (print)   ?   1 C! I like it! Wed Jul 19 2000 at 14:47:40

Just another interesting fact is that the longest English words that form another word when put through rot13 are 'abjurer' and 'nowhere'.

(thing) by wharfinger (6.2 y) (print)   ?   I like it! Mon Nov 06 2000 at 4:52:26

/*  Rot-13 encoder/decoder in C
 *
 *  This wretched little monstrosity is in the public domain.
 *  A much better solution is to use sed or tr. If you're on 
 *  Windows, go to the GNUish Project and download sed.
 *
 *  As with any simple character translation thing, a 
 *  lookup table would be more efficient, but... come on!
 *
 *  wharfinger  11/5/00
 */

#include <stdio.h>
#include <ctype.h>

int r13( int c );

int main()
{
    int c;

    while ( ( c = getchar() ) != EOF )
        putchar( r13( c ) );

    return 0;
}


int r13( int c )
{
    /*  Okay, it's a nested ternary. I know.
        This should probably be a macro, but macros this complex 
        get on my nerves.  
        'm' is the thirteenth letter of the alphabet.
        I mean, like, in case you didn't know or something.
    */
    return ( isalpha( c ) )
                ? ( ( tolower( c ) > 'm' ) ? ( c - 13 ) : ( c + 13 ) )
                : c;
}


(idea) by Jargon (1.6 y) (print)   ?   I like it! Thu Jul 19 2001 at 15:08:11

root mode = R = rotary debugger

rot13 /rot ther'teen/ n.,v.

[Usenet: from `rotate alphabet 13 places'] The simple Caesar-cypher encryption that replaces each English letter with the one 13 places forward or back along the alphabet, so that "The butler did it!" becomes "Gur ohgyre qvq vg!" Most Usenet news reading and posting programs include a rot13 feature. It is used to enclose the text in a sealed wrapper that the reader must choose to open -- e.g., for posting things that might offend some readers, or spoilers. A major advantage of rot13 over rot(N) for other N is that it is self-inverse, so the same code can be used for encoding and decoding. See also spoiler space, which has partly displaced rot13 since non-Unix-based newsreaders became common.

--The Jargon File version 4.3.1, ed. ESR, autonoded by rescdsk.


(thing) by tongpoo (1 mon) (print)   ?   1 C! I like it! Thu Jan 31 2002 at 8:40:08

Update 2/26/02: DelFick /msg'ed me with his version that works for IE and Mozilla (confirmed). Cross browser capability automatically makes it better than mine and daglo's. Here's an easy-to-copy-&-paste version:
javascript: if(document.all)sel=document.selection.createRange().text; else{sel=getSelection().toString(); }if(!sel)sel=prompt('Enter the text to ROT13',''); alpha="abcdefghijklmnopqrstuvwxyz"; alpha+=alpha+alpha.toUpperCase()+alpha.toUpperCase(); for(i=0,result=""; i<sel.length; result+=(alpha.indexOf(sel.charAt(i))<0)? sel.charAt(i++): alpha.charAt(alpha.indexOf(sel.charAt(i++))+13)); void(alert(result));
The code looks like this:
javascript:
if(document.all)
  sel=document.selection.createRange().text;
else {
  sel=getSelection().toString();
}
if(!sel)sel=prompt('Enter the text to ROT13','');
alpha="abcdefghijklmnopqrstuvwxyz";
alpha+=alpha+alpha.toUpperCase()+alpha.toUpperCase();
for(i=0,result=""; i < sel.length;
  result+=(alpha.indexOf(sel.charAt(i)) < 0)?
  sel.charAt(i++):
  alpha.charAt(alpha.indexOf(sel.charAt(i++))+13)
);
void(alert(result));
Changing the last line to void(prompt('result:', result)); makes the bookmarklet into a rot-13 writer also, where you can easily copy the rot-13 encoded text.
Here is my version of a Mozilla rot-13 decoder bookmarklet in one line for easy copy-and-pasting:

javascript:p=document.getSelection();if(!p)p=prompt('Text:',''); q=''; for(i=0;i<p.length;i++) {c=p.charCodeAt(i); q+=String.fromCharCode (c+((c<65)^(c<91)^(c<97)^(c<123)? (c-1)%32<13? 13:-13:0))}alert(q)

Paste this as the location of a bookmark, and you've got a rot13 decoding button. For the curious, an easier-to-read version of the same thing:
javascript:
p=document.getSelection();
if(!p)p=prompt('Text...','');
q='';
for(i=0; i<p.length; i++){
  c=p.charCodeAt(i);
  q+=String.fromCharCode(
    c+((c<65)^(c<91)^(c<97)^(c<123)? // *1
    (c-1)%32<13?13:-13:0)            // *2
  );
}
alert(q)

// *1 - true iff c represents an alphabet
// *2 - decide btwn move forward and loop around
Added functionality: works on selected text, a la Netscape Everything Search Button-style. Select a rot13 encoded text, and press the decoder button. If nothing is selected, a dialog box pops up asking you for text.

Test it here!
Guvf znl abg pbzr va unaql...

printable version
chaos

spoiler space Rot-13 ROT26 Caesar shift cipher
How the Petting Zoo eventually destroyed us all triple ROT13 TR The USA has fucked up priorities
ROT13 in Intercal Rotary debugger If cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl How to get around censorware
!seineew era sreenigne epacsteN Napster to filter by filename ZZ 9 plural Z alpha Abjurer
kid sister encryption Perl World's most flexible programming language 31337
Standard-issue high-school staple gun pr0n Kibo root mode
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
What you are reading:
Monster, we're here
Samurai women
One-pixel transparent GIF
two-fold cost of sex
Galapagos Hawk
Latex. High heels. Knives.
From across a crowded room
Dylan and the Dead
1965
Puberty seems to depress young women
Turkana Boy
Stuffed full o' Nodes Day 2004
The Gone, Growing in Number
New Writeups
Glowing Fish
The Uncanny X-Men and the New Teen Titans(thing)
WolfKeeper
Launch loop(idea)
TendoKing
Katana(person)
Wuukiee
Highly ornamental cultivars of brambles still have as many thorns as their wild counterparts(idea)
TheDeadGuy
Editor Log: May 2008(log)
everyday j.Lo
pray do not molest them(thing)
ammie
Bands Who Take Their Names from Eighteenth-century English Poetry and Prose(idea)
shaogo
Under My Thumb(review)
ammie
Rock On(person)
The Custodian
The Dresden Files(thing)
Ouzo
PETA becomes you, a proposed future(fiction)
Ereneta
Stone Soup, Part Two(fiction)
jjen
Sorrier than I ever thought I would be(personal)
locke baron
Moskva class antisubmarine cruiser(thing)
Wuukiee
May 15, 2008(idea)
E2 is a by-product of the existence of The Everything Development Company