ROT13 Table With Example
   HOME

TheInfoList



OR:

ROT13 ("rotate by 13 places", sometimes hyphenated ROT-13) is a simple letter
substitution cipher In cryptography, a substitution cipher is a method of encrypting in which units of plaintext are replaced with the ciphertext, in a defined manner, with the help of a key; the "units" may be single letters (the most common), pairs of letters, trip ...
that replaces a letter with the 13th letter after it in the alphabet. ROT13 is a special case of the Caesar cipher which was developed in ancient Rome. Because there are 26 letters (2×13) in the basic Latin alphabet, ROT13 is its own
inverse Inverse or invert may refer to: Science and mathematics * Inverse (logic), a type of conditional sentence which is an immediate inference made from another conditional sentence * Additive inverse (negation), the inverse of a number that, when ad ...
; that is, to undo ROT13, the same
algorithm In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific Computational problem, problems or to perform a computation. Algorithms are used as specificat ...
is applied, so the same action can be used for encoding and decoding. The algorithm provides virtually no
cryptographic Cryptography, or cryptology (from grc, , translit=kryptós "hidden, secret"; and ''graphein'', "to write", or '' -logia'', "study", respectively), is the practice and study of techniques for secure communication in the presence of adve ...
security, and is often cited as a canonical example of weak encryption. ROT13 is used in
online forum An Internet forum, or message board, is an online discussion site where people can hold conversations in the form of posted messages. They differ from chat rooms in that messages are often longer than one line of text, and are at least temporar ...
s as a means of hiding
spoiler Spoiler is a security vulnerability on modern computer central processing units that use speculative execution. It exploits side-effects of speculative execution to improve the efficiency of Rowhammer and other related memory and cache attacks. Ac ...
s,
punchlines ''Punchlines'' was a comedy panel game show that aired on ITV from 3 January 1981 to 22 December 1984 and was hosted by Lennie Bennett. The show itself was based on a failed 1979 American game show pilot of the same name hosted by Bill Cullen, wh ...
, puzzle solutions, and
offensive material Offensive may refer to: * Offensive, the former name of the Dutch political party Socialist Alternative * Offensive (military), an attack * Offensive language ** Fighting words or insulting language, words that by their very utterance inflict inj ...
s from the casual glance. ROT13 has inspired a variety of letter and word games online, and is frequently mentioned in
newsgroup A Usenet newsgroup is a repository usually within the Usenet system, for messages posted from users in different locations using the Internet. They are discussion groups and are not devoted to publishing news. Newsgroups are technically distinct ...
conversations.


Description

Applying ROT13 to a piece of text merely requires examining its alphabetic characters and replacing each one by the letter 13 places further along in the
alphabet An alphabet is a standardized set of basic written graphemes (called letters) that represent the phonemes of certain spoken languages. Not all writing systems represent language in this way; in a syllabary, each character represents a syll ...
, wrapping back to the beginning if necessary. A becomes N, B becomes O, and so on up to M, which becomes Z, then the sequence continues at the beginning of the alphabet: N becomes A, O becomes B, and so on to Z, which becomes M. Only those letters which occur in the
English alphabet The alphabet for Modern English is a Latin-script alphabet consisting of 26 letters, each having an upper- and lower-case form. The word ''alphabet'' is a compound of the first two letters of the Greek alphabet, '' alpha'' and '' beta''. ...
are affected; numbers, symbols, punctuation, whitespace, and all other characters are left unchanged. Because there are 26 letters in the English alphabet and 26 = 2 × 13, the ROT13 function is its own
inverse Inverse or invert may refer to: Science and mathematics * Inverse (logic), a type of conditional sentence which is an immediate inference made from another conditional sentence * Additive inverse (negation), the inverse of a number that, when ad ...
: :\mbox_(\mbox_(x))=x for any basic Latin-alphabet text ''x''. In other words, two successive applications of ROT13 restore the original text (in
mathematics Mathematics is an area of knowledge that includes the topics of numbers, formulas and related structures, shapes and the spaces in which they are contained, and quantities and their changes. These topics are represented in modern mathematics ...
, this is sometimes called an ''
involution Involution may refer to: * Involute, a construction in the differential geometry of curves * '' Agricultural Involution: The Processes of Ecological Change in Indonesia'', a 1963 study of intensification of production through increased labour inpu ...
''; in cryptography, a ''
reciprocal cipher Symmetric-key algorithms are algorithms for cryptography that use the same cryptographic keys for both the encryption of plaintext and the decryption of ciphertext. The keys may be identical, or there may be a simple transformation to go between th ...
''). The transformation can be done using a
lookup table In computer science, a lookup table (LUT) is an array that replaces runtime computation with a simpler array indexing operation. The process is termed as "direct addressing" and LUTs differ from hash tables in a way that, to retrieve a value v wi ...
, such as the following: For example, in the following joke, the punchline has been obscured by ROT13: : Why did the chicken cross the road? :Gb trg gb gur bgure fvqr! Transforming the entire text via ROT13 form, the answer to the joke is revealed: : Jul qvq gur puvpxra pebff gur ebnq? : To get to the other side! A second application of ROT13 would restore the original.


Usage

ROT13 is a special case of the
encryption algorithm In cryptography, encryption is the process of encoding information. This process converts the original representation of the information, known as plaintext, into an alternative form known as ciphertext. Ideally, only authorized parties can decip ...
known as a Caesar cipher, used by
Julius Caesar Gaius Julius Caesar (; ; 12 July 100 BC – 15 March 44 BC), was a Roman general and statesman. A member of the First Triumvirate, Caesar led the Roman armies in the Gallic Wars before defeating his political rival Pompey in a civil war, and ...
in the 1st century BC.
Johann Ernst Elias Bessler Johann Ernst Elias Bessler (''ca''. 1680 – 30 November 1745), known as Orffyreus or Orffyré, was a German entrepreneur who claimed to have built several perpetual motion machines. Those claims generated considerable interest and controversy a ...
, an 18th century clockmaker and constructor of
perpetual motion Perpetual motion is the motion of bodies that continues forever in an unperturbed system. A perpetual motion machine is a hypothetical machine that can do work infinitely without an external energy source. This kind of machine is impossible, a ...
machines, pointed out that ROT13 encodes his surname as ''Orffyre''. He used its latinised form, ''Orffyreus'', as his pseudonym. ROT13 was in use in the net.jokes
newsgroup A Usenet newsgroup is a repository usually within the Usenet system, for messages posted from users in different locations using the Internet. They are discussion groups and are not devoted to publishing news. Newsgroups are technically distinct ...
by the early 1980s. It is used to hide potentially offensive jokes, or to obscure an answer to a puzzle or other
spoiler Spoiler is a security vulnerability on modern computer central processing units that use speculative execution. It exploits side-effects of speculative execution to improve the efficiency of Rowhammer and other related memory and cache attacks. Ac ...
. A shift of thirteen was chosen over other values, such as three as in the original Caesar cipher, because thirteen is the value for which encoding and decoding are equivalent, thereby allowing the convenience of a single command for both. ROT13 is typically supported as a built-in feature to newsreading software. Email addresses are also sometimes encoded with ROT13 to hide them from less sophisticated spam bots. It is also used to circumvent email screening and spam filtering. By obscuring an email's content, the screening algorithm is unable to identify the email as, for instance, a security risk, and allows it into the recipient's in-box. In encrypted, normal, English-language text of any significant size, ROT13 is recognizable from some letter/word patterns. The words "n", "V" (capitalized only), and "gur" (ROT13 for "a", "I", and "the"), and words ending in "yl" ("ly") are examples. ROT13 is not intended to be used where
secrecy Secrecy is the practice of hiding information from certain individuals or groups who do not have the "need to know", perhaps while sharing it with other individuals. That which is kept hidden is known as the secret. Secrecy is often controvers ...
is of any concern—the use of a constant shift means that the encryption effectively has no
key Key or The Key may refer to: Common meanings * Key (cryptography), a piece of information that controls the operation of a cryptography algorithm * Key (lock), device used to control access to places or facilities restricted by a lock * Key (map ...
, and decryption requires no more knowledge than the fact that ROT13 is in use. Even without this knowledge, the algorithm is easily broken through
frequency analysis In cryptanalysis, frequency analysis (also known as counting letters) is the study of the frequency of letters or groups of letters in a ciphertext. The method is used as an aid to breaking classical ciphers. Frequency analysis is based on t ...
. Because of its utter unsuitability for real secrecy, ROT13 has become a catchphrase to refer to any conspicuously weak
encryption In cryptography, encryption is the process of encoding information. This process converts the original representation of the information, known as plaintext, into an alternative form known as ciphertext. Ideally, only authorized parties can decip ...
scheme; a critic might claim that "56-bit
DES Des is a masculine given name, mostly a short form (hypocorism) of Desmond. People named Des include: People * Des Buckingham, English football manager * Des Corcoran, (1928–2004), Australian politician * Des Dillon (disambiguation), sever ...
is little better than ROT13 these days". Also, in a play on real terms like "double DES", the terms "double ROT13", "ROT26", or "2ROT13" crop up with humorous intent (due to the fact that, since applying ROT13 to an already ROT13-encrypted text restores the original
plaintext In cryptography, plaintext usually means unencrypted information pending input into cryptographic algorithms, usually encryption algorithms. This usually refers to data that is transmitted or stored unencrypted. Overview With the advent of comp ...
, ROT26 is equivalent to no encryption at all), including a spoof academic paper entitled "On the 2ROT13 Encryption Algorithm". By extension, triple-ROT13 (used in joking analogy with 3DES) is equivalent to regular ROT13. In December 1999, it was found that
Netscape Communicator Netscape Communicator (or ''Netscape 4'') is a discontinued Internet suite produced by Netscape Communications Corporation, and was the fourth major release in the Netscape line of browsers. It was first in beta in 1996 and was released in June 1 ...
used ROT13 as part of an insecure scheme to store email passwords. In 2001, Russian programmer Dimitry Sklyarov demonstrated that an eBook vendor, New Paradigm Research Group (NPRG), used ROT13 to encrypt their documents; it has been speculated that NPRG may have mistaken the ROT13 toy example—provided with the
Adobe Adobe ( ; ) is a building material made from earth and organic materials. is Spanish for ''mudbrick''. In some English-speaking regions of Spanish heritage, such as the Southwestern United States, the term is used to refer to any kind of e ...
eBook
software development kit A software development kit (SDK) is a collection of software development tools in one installable package. They facilitate the creation of applications by having a compiler, debugger and sometimes a software framework. They are normally specific to ...
—for a serious encryption scheme. Windows XP uses ROT13 on some of its registry keys. ROT13 is also used in the Unix fortune program to conceal potentially offensive dicta.


Letter games and net culture

ROT13 provides an opportunity for letter games. Some words will, when transformed with ROT13, produce another word. Examples of 7-letter pairs in the
English language English is a West Germanic language of the Indo-European language family, with its earliest forms spoken by the inhabitants of early medieval England. It is named after the Angles, one of the ancient Germanic peoples that migrated to the is ...
are '' abjurer'' and ''nowhere'', and '' Chechen'' and ''
purpura Purpura () is a condition of red or purple discolored spots on the skin that do not blanch on applying pressure. The spots are caused by bleeding underneath the skin secondary to platelet disorders, vascular disorders, coagulation disorders, ...
''. Other examples of words like these are shown in the table. The pair ''
gnat A gnat () is any of many species of tiny flying insects in the dipterid suborder Nematocera, especially those in the families Mycetophilidae, Anisopodidae and Sciaridae. They can be both biting and non-biting. Most often they fly in large num ...
'' and ''tang'' is an example of words that are both ROT13 reciprocals and reversals. The 1989
International Obfuscated C Code Contest The International Obfuscated C Code Contest (abbreviated IOCCC) is a computer programming contest for the most creatively obfuscated C code. Held annually, it is described as "celebrating 'ssyntactical opaqueness". The winning code for the 27t ...
(IOCCC) included an entry by Brian Westley. Westley's
computer program A computer program is a sequence or set of instructions in a programming language for a computer to execute. Computer programs are one component of software, which also includes documentation and other intangible components. A computer program ...
can be encoded in ROT13 or reversed and still compiles correctly. Its operation, when executed, is either to perform ROT13 encoding on, or to reverse its input. 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 myth An urban legend (sometimes contemporary legend, modern legend, urban myth, or urban tale) is a genre of folklore comprising stories or fallacious claims circulated as true, especially as having happened to a "friend of a friend" or a family m ...
s on alt.folklore.urban, after some posters complained that "Sheesh!" as a response to
newcomer Newcomer may refer to: * Newcomer (surname) * Newcomer (Lenape), chief of the western Lenape and founder of Newcomerstown, Ohio * Newcomer, Missouri, a community in the United States * Novichok agent, ''Novichok'' meaning 'Newcomer' in Russian la ...
s was being overused.


Variants

ROT5 is a practice similar to ROT13 that applies to numeric digits (0 to 9). ROT13 and ROT5 can be used together in the same message, sometimes called ROT18 (18 = 13 + 5) or ROT13.5. ROT47 is a derivative of ROT13 which, in addition to scrambling the basic letters, treats numbers and common symbols. Instead of using the sequence A–Z as the alphabet, ROT47 uses a larger set of characters from the common
character encoding Character encoding is the process of assigning numbers to Graphics, graphical character (computing), characters, especially the written characters of Language, human language, allowing them to be Data storage, stored, Data communication, transmi ...
known as
ASCII ASCII ( ), abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Because of ...
. Specifically, the 7-bit printable characters, excluding space, from decimal 33 '!' through 126 '~', 94 in total, taken in the order of the numerical values of their ASCII codes, are rotated by 47 positions, without special consideration of case. For example, the character A is mapped to p, while a is mapped to 2. The use of a larger alphabet produces a more thorough obfuscation than that of ROT13; for example, a telephone number such as +1-415-839-6885 is not obvious at first sight from the scrambled result Z'\c`d\gbh\eggd. On the other hand, because ROT47 introduces numbers and symbols into the mix without discrimination, it is more immediately obvious that the text has been encoded. Example: :The Quick Brown Fox Jumps Over The Lazy Dog. enciphers to :%96 "F:4< qC@H? u@I yF>AD ~G6C %96 {2KJ s@8] The
GNU C library The GNU C Library, commonly known as glibc, is the GNU Project's implementation of the C standard library. Despite its name, it now also directly supports C++ (and, indirectly, other programming languages). It was started in the 1980s by ...
, a set of standard routines available for use in
computer programming Computer programming is the process of performing a particular computation (or more generally, accomplishing a specific computing result), usually by designing and building an executable computer program. Programming involves tasks such as ana ...
, contains a
function Function or functionality may refer to: Computing * Function key, a type of key on computer keyboards * Function model, a structured representation of processes in a system * Function object or functor or functionoid, a concept of object-oriente ...
memfrob()—which has a similar purpose to ROT13, although it is intended for use with arbitrary binary data. The function operates by combining each
byte The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable unit ...
with the
binary Binary may refer to: Science and technology Mathematics * Binary number, a representation of numbers using only two digits (0 and 1) * Binary function, a function that takes two arguments * Binary operation, a mathematical operation that t ...
pattern 00101010 ( 42) using the
exclusive or Exclusive or or exclusive disjunction is a logical operation that is true if and only if its arguments differ (one is true, the other is false). It is symbolized by the prefix operator J and by the infix operators XOR ( or ), EOR, EXOR, , ...
(XOR) operation. This effects a simple XOR cipher. Like ROT13, XOR (and therefore memfrob()) is self-reciprocal, and provides a similar, virtually absent, level of security.


Implementation


tr

The ROT13 and ROT47 are fairly easy to implement using the Unix terminal application tr; to encrypt the string "The Quick Brown Fox Jumps Over The Lazy Dog" in ROT13: $ # Map upper case A-Z to N-ZA-M and lower case a-z to n-za-m $ tr 'A-Za-z' 'N-ZA-Mn-za-m' <<< "The Quick Brown Fox Jumps Over The Lazy Dog" Gur Dhvpx Oebja Sbk Whzcf Bire Gur Ynml Qbt and the same string for ROT47: $ echo "The Quick Brown Fox Jumps Over The Lazy Dog" , tr '\!-~' 'P-~\!-O' %96 "F:4< qC@H? u@I yF>AD ~G6C %96 {2KJ s@8


Emacs and Vim

In
Emacs Emacs , originally named EMACS (an acronym for "Editor MACroS"), is a family of text editors that are characterized by their extensibility. The manual for the most widely used variant, GNU Emacs, describes it as "the extensible, customizable, s ...
, one can ROT13 the buffer or a selection with the following commands: M-x toggle-rot13-mode M-x rot13-other-window M-x rot13-region and in the Vim text editor, one can ROT13 a buffer with the command: ggg?G


Python

The module provides text transform. >>> s = """The Zen of Python, by Tim Peters ... Beautiful is better than ugly. ... Explicit is better than implicit. ... Simple is better than complex. ... Complex is better than complicated. ... Flat is better than nested. ... Sparse is better than dense. ... Readability counts. ... Special cases aren't special enough to break the rules. ... Although practicality beats purity. ... Errors should never pass silently. ... Unless explicitly silenced. ... In the face of ambiguity, refuse the temptation to guess. ... There should be one-- and preferably only one --obvious way to do it. ... Although that way may not be obvious at first unless you're Dutch. ... Now is better than never. ... Although never is often better than *right* now. ... If the implementation is hard to explain, it's a bad idea. ... If the implementation is easy to explain, it may be a good idea. ... Namespaces are one honking great idea -- let's do more of those! ... """ >>> import codecs >>> print(codecs.encode(s, 'rot13')) Gur Mra bs Clguba, ol Gvz Crgref Ornhgvshy vf orggre guna htyl. Rkcyvpvg vf orggre guna vzcyvpvg. Fvzcyr vf orggre guna pbzcyrk. Pbzcyrk vf orggre guna pbzcyvpngrq. Syng vf orggre guna arfgrq. Fcnefr vf orggre guna qrafr. Ernqnovyvgl pbhagf. Fcrpvny pnfrf nera'g fcrpvny rabhtu gb oernx gur ehyrf. Nygubhtu cenpgvpnyvgl orngf chevgl. Reebef fubhyq arire cnff fvyragyl. Hayrff rkcyvpvgyl fvyraprq. Va gur snpr bs nzovthvgl, ershfr gur grzcgngvba gb thrff. Gurer fubhyq or bar-- naq cersrenoyl bayl bar --boivbhf jnl gb qb vg. Nygubhtu gung jnl znl abg or boivbhf ng svefg hayrff lbh'er Qhgpu. Abj vf orggre guna arire. Nygubhtu arire vf bsgra orggre guna *evtug* abj. Vs gur vzcyrzragngvba vf uneq gb rkcynva, vg'f n onq vqrn. Vs gur vzcyrzragngvba vf rnfl gb rkcynva, vg znl or n tbbq vqrn. Anzrfcnprf ner bar ubaxvat terng vqrn -- yrg'f qb zber bs gubfr!


See also

*
Cryptanalysis Cryptanalysis (from the Greek ''kryptós'', "hidden", and ''analýein'', "to analyze") refers to the process of analyzing information systems in order to understand hidden aspects of the systems. Cryptanalysis is used to breach cryptographic sec ...
*
Atbash Atbash ( he, אתבש; also transliterated Atbaš) is a monoalphabetic substitution cipher originally used to encrypt the Hebrew alphabet. It can be modified for use with any known writing system with a standard collating order. Encryption Th ...


References


External links


Online converter
for ROT13, ROT5, ROT18, ROT47,
Atbash Atbash ( he, אתבש; also transliterated Atbaš) is a monoalphabetic substitution cipher originally used to encrypt the Hebrew alphabet. It can be modified for use with any known writing system with a standard collating order. Encryption Th ...
and Caesar cipher.
ROT13 to Text on PureTables.com
{{DEFAULTSORT:Rot13 Classical ciphers Internet culture