ROT13
|
ROT13 ("ROTate by 13 places", sometimes hyphenated ROT-13, or lowercase rot13) is a simple Caesar cipher used for obscuring text by replacing each letter with the letter thirteen places down the alphabet. A becomes N, B becomes O and so on. The algorithm is used in online forums as a means of hiding joke punchlines, puzzle solutions, movie and story spoilers, and offensive materials from the casual glance. ROT13 has been described as the "Usenet equivalent of a magazine printing the answer to a quiz upside down" [1] (http://groups.google.com/groups?selm=UZ36hgCSoh%24%2BEwqG%40nodomain.nodomain.us).
The name "ROT13" originated on Usenet in the early 1980s, and the method has become a de facto standard. Although a Caesar cipher, a method of encryption thousands of years old, ROT13 provides no real cryptographic security and is not used for such; in fact it is often used as the canonical example of weak encryption. Because ROT13 scrambles only letters, more complex schemes have been proposed to handle numbers and punctuation, or arbitrary binary data.
Contents |
Description
To apply ROT13 to a piece of text, take every letter in the Latin alphabet and replace it by the letter 13 places further along in the alphabet, wrapping back to the beginning if necessary, preserving case: a becomes n, B becomes O, and so forth, down to Z, which becomes M. Numbers, symbols, and other characters are left unchanged. Because there are 26 letters in the Latin alphabet and 26 = 2 × 13, the ROT13 function is its own inverse:
- <math>\mbox{ROT}_{13}(\mbox{ROT}_{13}(x))=\mbox{ROT}_{26}(x)=x<math> for any text x.
In other words, two successive applications of ROT13 restore the original text (in mathematics, this is sometimes called an involution).
The transformation can be done using a lookup table, such as the following:
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz |
NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm |
For example, someone might wish to obscure the following text:
How can you tell an extrovert from an introvert at NSA? In the elevators, the extroverts look at the OTHER guy's shoes.
Transformed into ROT13 form, the text would become:
Ubj pna lbh gryy na rkgebireg sebz na vagebireg ng AFN? Va gur ryringbef, gur rkgebiregf ybbx ng gur BGURE thl'f fubrf.
A second application of ROT13 would restore the original.
History
ROT13 originated in the net.jokes newsgroup in the early 1980s(1), in an effort to provide a voluntary means to hide sexually offensive jokes. Previous attempts to categorize offensive jokes by putting them in different newsgroups had failed — site managers did not want to be seen as condoning such postings by creating a special place for them. ROT13 was a convenient solution because of its simplicity. Since it replaces alphabet letters with other letters, ROT13 did not cause problems for newsgroup software which sometimes had problems with unusual kinds of characters. ROT-13 was chosen over ROT-N (for other values of N between 1 and 25) because 13 is the only shift value which ensures that encoding and decoding are equivalent. Note that this is true only for languages which have 26 letters in their alphabets (eg, not Polish which has more, nor Hawaiian which has fewer; as it happens, English has 26 which is likely why ROT-13 and not, say, ROT-15, became standard).
While users could plausibly encode and decode messages by hand, automatic decryption is much more convenient; UNIX systems have a standard utility called "tr" (transliterate) which can be used to perform ROT13 encoding:
- tr A-Za-z N-ZA-Mn-za-m
Automatic deciphering was soon added to newsreading software.
ROT13 as encryption
ROT13 can be viewed as one of a group of historical encryption algorithms known as Caesar ciphers, a type of substitution cipher. It is not intended to be used where secrecy is a serious concern—the use of a constant shift of 13 letters means that the encryption effectively has no key, and decryption requires no more knowledge than the fact that ROT13 is in use; even without this knowledge, like any substitution cipher the algorithm is easily broken through frequency analysis or the exploitation of pattern words.
The real effect of ROT13 is to make sure that the viewer of a message must consciously choose to decipher it, which typically means invoking the relevant ROT13 command in his or her software. Rather than protecting a confidential message from unauthorized readers, ROT13 safeguards readers from material they may not wish to inadvertently read, such as spoilers in book or movie reviews.
Because of its unsuitability for secrecy, ROT13 has become a catchphrase to refer to any weak encryption, for example: "56-bit DES is no better than ROT13 these days." The terms double ROT13, ROT26 or 2ROT13 are also used humorously, including a spoof academic paper "On the 2ROT13 Encryption Algorithm" (PDF) (http://phoenix.clifford.at/~ak/2rot13.pdf). As explained above, applying ROT13 to an already ROT13 encrypted text restores the original plaintext, so ROT26 is equivalent to no encryption at all. ROT26 has been used as a satirical jibe against the United States' Digital Millennium Copyright Act (DMCA); some online users append phrases such as "Encoded with ROT26 — circumvention will be prosecuted!" to their posts to online forums. The DMCA introduced a broad ban on the circumvention of copy prevention systems, which often employ insecure methods of cryptography. Triple ROT13 is also sometimes seen - which is, of course, completely the same as regular ROT13. This is most probably a take on Triple DES.
In 2001, Russian cryptanalyst Dmitry Sklyarov was arrested after detailing weaknesses in ebook copy prevention systems. Ebooks (books available in digital or electronic format) sometimes include technical measures to enforce copyright. One vendor, New Paradigm Research Group (NPRG), used ROT13 to encrypt their reports. It has been speculated that NPRG may have mistaken the ROT13 toy example — provided with the Adobe eBook software development kit — for a serious encryption scheme [2] (http://techupdate.zdnet.com/techupdate/stories/main/0,14179,2801118-2,00.html).
Trivia
| |||
aha ↔ nun | ant ↔ nag | ||
balk ↔ onyx | bar ↔ one | ||
barf ↔ ones | be ↔ or | ||
bin ↔ ova | ebbs ↔ roof | ||
envy ↔ rail | er ↔ re | ||
errs ↔ reef | flap ↔ sync | ||
fur ↔ she | gel ↔ try | ||
gnat ↔ tang | irk ↔ vex |
ROT13 provides an opportunity for letter games. Some words will, when transformed with ROT13, produce another word. The longest example in the English language is the pair of 7-letter words abjurer and nowhere; there is also the 7-letter pair chechen and purpura. Other examples of words like these are shown in the table.
The word ravine is transformed under ROT13 to enivar — its reversal, although not a word. The only known pair of common English words which are each other's ROT13 and reversal are gnat and tang.
vex is transformed to irk under ROT13; the words are synonyms. Also, terra can be transformed to green to give a satisfying pair.
The 1989 International Obfuscated C Code Contest (IOCCC) included an entry by Brian Westley. Westley's computer program can be ROT13'd or reversed and still compiles correctly. Its operation, when executed, is to either perform ROT13 encoding on or to reverse its input [3] (http://www.ioccc.org/1989/westley.c),[4] (http://www.ioccc.org/1989/westley.hint).
The newsgroup alt.folklore.urban coined a word — furrfu — that was the ROT13 encoding of the frequently encoded utterance "sheesh". "Furrfu" evolved in mid-1992 as a response to postings repeating urban myths on alt.folklore.urban, after some posters complained that "Sheesh!" as a response to newcomers was being overused [5] (http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?furrfu).
Variants
There are other little-used obfuscation schemes with a similar purpose to ROT13. ROT13 only handles letters, and leaves other characters, such as punctuation, numbers and whitespace, untouched. Because of this, ROT13 may be unsuitable for some purposes, for example, hiding the numeric answer to a riddle, or handling arbitrary binary data.
ROT47
ROT47 is a variant on ROT13 which, in addition to scrambling the basic letters, also treats numbers and many other characters. Instead of using the sequence A-Z as the alphabet, ROT47 uses a larger alphabet, derived from a common character encoding known as ASCII. ASCII maps letters, digits, punctutation and other special characters to numbers in the range 0–127. Viewed in ASCII, ROT13 covers the codes 65–90 and 97–122 — the upper and lower case letters respectively. ROT47 uses 94 characters instead, from ! (the exclamation mark, ASCII code 33) to ~ (the tilde, ASCII code 126), rotating them by an offset of 47. The use of a larger alphabet is intended to produce a more thorough obfuscation than that of ROT13, but ROT47 is far less widely supported.
Applying ROT47 to the earlier example gives:
w@H 42? J@F E6== 2? 6IEC@G6CE 7C@> 2? :?EC@G6CE 2E }$pn x? E96 6=6G2E@CD[ E96 6IEC@G6CED =@@< 2E E96 ~%wt# 8FJVD D9@6D]
The Unix command to apply ROT47 is:
- tr '!-~' 'P-~!-O'
memfrob()
The GNU C library (a set of standard routines available for use in computer programming) contains a function — memfrob()[6] (http://www.delorie.com/gnu/docs/glibc/libc_81.html) — which has a similar purpose to ROT13, although it is intended for use with arbitrary binary data. The function operates (humourously termed "frobnicates") by combining each byte with the binary pattern 00101010 (42 decimal) using the exclusive or (XOR) operation. This effects a simple XOR cipher, a weak form of encryption. Like ROT13, memfrob() is self-reciprocal.
Footnotes
(1) — early uses of ROT13 found in the Google USENET archive date back to 8 October 1982, posted to the net.jokes newsgroup [7] (http://groups.google.com/groups?selm=bnews.desoto.299)[8] (http://groups.google.com/groups?selm=bnews.utcsrgv.596).
See also
References
- Eric S. Raymond (Editor), the Jargon File, [9] (http://www.catb.org/~esr/jargon/html/R/rot13.html).
- Bruce Schneier, Applied Cryptography, 2nd edition, Wiley, 1996, p11. ISBN 0471117099.
External links
- Words with interesting properties under ROT13 (http://www.furrfu.org/rot13words.html)
- Online ROT13 encoder (http://www.rot13.com/)
- Another online ROT13 encoder/decoder in JavaScript (http://tools.geht.net/rot13.html)
- Bilingual (Portuguese/English) page with explanations, links and software information (http://www.dantas.com/rot13)
- ROT13 Bookmarklet (http://www.squarefree.com/bookmarklets/pagedata.html#rot13_selection)
- Software for ROT13 in a large number of languages (http://www.miranda.org/~jkominek/rot13/) — includes a patch to SSH to add support for ROT13, and a cryptanalysis tool to automatically distinguish ROT13 text from plaintext.
- A description of ROT13 (http://www.everything2.org/index.pl?node=ROT13) — on the Everything2 website
- ROT47 encoding/decoding (http://www.senses0.org.mv/popzees/rot/rotn.php)
- ROT47 and ROT13 encoding/decoding (http://www.just-stuart.com/cgi-bin/ur13)
- This FireFox extension supports ROT13 conversions and typing (http://leetkey.mozdev.org)