ROT 13
   HOME

TheInfoList



OR:

ROT13 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, t ...
that replaces a letter with the 13th letter after it in the
Latin alphabet The Latin alphabet, also known as the Roman alphabet, is the collection of letters originally used by the Ancient Rome, ancient Romans to write the Latin language. Largely unaltered except several letters splitting—i.e. from , and from â ...
. ROT13 is a special case of the
Caesar cipher In cryptography, a Caesar cipher, also known as Caesar's cipher, the shift cipher, Caesar's code, or Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in t ...
which was developed in ancient Rome, used by
Julius Caesar Gaius Julius Caesar (12 or 13 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 Caesar's civil wa ...
in the 1st century BC. An early entry on the
Timeline of cryptography Below is a timeline of notable events related to cryptography. B.C.E. * 36th century The Sumerians develop ''cuneiform'' writing and the Egyptians develop ''hieroglyphic'' writing. * 16th century The Phoenicians develop an alphabet * 600-500 He ...
. ROT13 can be referred by "Rotate13", "rotate by 13 places", hyphenated "ROT-13" or sometimes by its
autonym Autonym may refer to: * Autonym, the name used by a person to refer to themselves or their language; see Exonym and endonym * Autonym (botany), an automatically created infrageneric or infraspecific name See also * Nominotypical subspecies, in zo ...
"EBG13".


Description

Applying ROT13 to a piece of text requires examining its alphabetic characters and replacing each one by the letter 13 places further along in the
alphabet An alphabet is a standard set of letter (alphabet), letters written to represent particular sounds in a spoken language. Specifically, letters largely correspond to phonemes as the smallest sound segments that can distinguish one word from a ...
, wrapping back to the beginning as necessary. When encoding a message, 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. When decoding a message, the same substitution rules are applied, but this time on the ROT13 encrypted text. Other characters, such as numbers, symbols, punctuation or
whitespace White space or whitespace may refer to: Technology * Whitespace characters, characters in computing that represent horizontal or vertical space * White spaces (radio), allocated but locally unused radio frequencies * TV White Space Database, a m ...
, are left unchanged. Because there are 26 letters in the
Latin alphabet The Latin alphabet, also known as the Roman alphabet, is the collection of letters originally used by the Ancient Rome, ancient Romans to write the Latin language. Largely unaltered except several letters splitting—i.e. from , and from â ...
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, the inverse of a number that, when added to the ...
: :\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 a field of study that discovers and organizes methods, Mathematical theory, theories and theorems that are developed and Mathematical proof, proved for the needs of empirical sciences and mathematics itself. There are many ar ...
, this is sometimes called an ''
involution Involution may refer to: Mathematics * Involution (mathematics), a function that is its own inverse * Involution algebra, a *-algebra: a type of algebraic structure * Involute, a construction in the differential geometry of curves * Exponentiati ...
''; 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 ...
''). The transformation can be done using a
lookup table In computer science, a lookup table (LUT) is an array data structure, array that replaces runtime (program lifecycle phase), runtime computation of a mathematical function (mathematics), function with a simpler array indexing operation, in a proc ...
, 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 not intended to be used in modern times. At the time of conception in an era of
Ancient Roman technology Ancient Roman technology is the collection of techniques, skills, methods, processes, and engineering practices which supported Roman civilization and made possible the expansion of the economy and military of ancient Rome (753 BC – 476 AD). ...
, the encryption scheme was not represented by a
mathematical structure In mathematics, a structure on a set (or on some sets) refers to providing or endowing it (or them) with certain additional features (e.g. an operation, relation, metric, or topology). Τhe additional features are attached or related to the ...
. The key to decrypt a message requires no more knowledge than the fact that ROT13 is in use. Even if
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 controver ...
does not fail, any alien party or individual, capable of intercepting the message, could break the code by spending enough time on decoding the text 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 th ...
or finding other
patterns A pattern is a regularity in the world, in human-made design, or in abstract ideas. As such, the elements of a pattern repeat in a predictable manner. A geometric pattern is a kind of pattern formed of geometric shapes and typically repeated li ...
. In the early 1980s, people used ROT13 in their messages on Usenet newsgroup servers They did this to hide potentially offensive jokes, or to obscure an answer to a puzzle or other
spoiler Spoiler or Spoilers may refer to: Arts, entertainment and media * Spoiler (media), something that reveals significant plot elements * The Spoiler, DC Comics superheroine Stephanie Brown Film and television * ''Spoiler'' (film), 1998 American ...
, or to fool less sophisticated spam bots dubious – Talk:ROT13#Dubious">discuss Conversation is interactive communication between two or more people. The development of conversational skills and etiquette is an important part of socialization. The development of conversational skills in a new language is a frequent focus ...
'']. ROT13 has been the subject of many jokes. The 1989 International Obfuscated C Code Contest (IOCCC) included an entry by Brian Westley. Westley's 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. 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 Jun ...
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 (from arabic: الطوب Attub ; ) 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 use ...
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 t ...
—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 In legal writing, a (Latin 'something that has been said'; plural ) is a statement made by a court. It may or may not be binding as a precedent. United States In United States legal terminology, a ''dictum'' is a statement of opinion conside ...
. Johann Ernst Elias Bessler, an 18th-century clock maker 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 indefinitely without an external energy source. This kind of machine is impossible ...
machines, pointed out that ROT13 encodes his surname as ''Orffyre''. He used its latinised form, ''Orffyreus'', as his pseudonym.


Net culture

Because of its utter unsuitability for real secrecy, ROT13 has become a catchphrase to refer to any conspicuously weak
encryption In Cryptography law, cryptography, encryption (more specifically, Code, encoding) is the process of transforming information in a way that, ideally, only authorized parties can decode. This process converts the original representation of the inf ...
scheme; a critic might claim that "56-bit DES is little better than ROT13 these days". In a play on real terms like "double DES" several terms cropped up with humorous intent: * Double ROT13: 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: equivalent to no encryption at all. * 2ROT13 was included in a spoof academic paper entitled "On the 2ROT13 Encryption Algorithm". * triple-ROT13: used jokingly in analogy with 3DES, it is equivalent to regular ROT13. ROT13 jokes were popular on many
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 not only discussion groups or conversations, but also a repository to publish articles, start ...
servers, like net.jokes as early as the 1980s. 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 Urban legend (sometimes modern legend, urban myth, or simply legend) is a genre of folklore concerning stories about an unusual (usually scary) or humorous event that many people believe to be true but largely are not. These legends can be e ...
s on alt.folklore.urban, after some posters complained that "Sheesh!" as a response to
newcomer Newcomer, or The Newcomer, may refer to: Literature * , a 2009 novel by Keigo Higashino * '' The Newcomer'', a 1966 novel by Hilda Pressley * '' The Newcomer'', a 2013 novel by Robyn Carr; the second installment in the ''Thunder Point'' series * ...
s was being overused. Using a
search engine A search engine is a software system that provides hyperlinks to web pages, and other relevant information on World Wide Web, the Web in response to a user's web query, query. The user enters a query in a web browser or a mobile app, and the sea ...
on public social networks, yields results for ROT13 in jokes to this day.


Letter games

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 that developed in early medieval England and has since become a English as a lingua franca, global lingua franca. The namesake of the language is the Angles (tribe), Angles, one of the Germanic peoples th ...
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 GNAT is a free-software compiler for the Ada programming language which forms part of the GNU Compiler Collection (GCC). It supports all versions of the language, i.e. Ada 2012, Ada 2005, Ada 95 and Ada 83. Originally its ...
'' and ''tang'' is an example of words that are both ROT13 reciprocals and reversals.


Variants and combinations

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 graphical character (computing), characters, especially the written characters of human language, allowing them to be stored, transmitted, and transformed using computers. The numerical v ...
known as
ASCII ASCII ( ), an acronym for American Standard Code for Information Interchange, is a character encoding standard for representing a particular set of 95 (English language focused) printable character, printable and 33 control character, control c ...
. 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 implementation of the C standard library. It provides a wrapper around the system calls of the Linux kernel and other kernels for application use. Despite its name, it now also dir ...
, a set of standard routines available for use in
computer programming Computer programming or coding is the composition of sequences of instructions, called computer program, programs, that computers can follow to perform tasks. It involves designing and implementing algorithms, step-by-step specifications of proc ...
, 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-orie ...
—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 un ...
with the
binary Binary may refer to: Science and technology Mathematics * Binary number, a representation of numbers using only two values (0 and 1) for each digit * Binary function, a function that takes two arguments * Binary operation, a mathematical op ...
pattern 00101010 ( 42) using the
exclusive or Exclusive or, exclusive disjunction, exclusive alternation, logical non-equivalence, or logical inequality is a logical operator whose negation is the logical biconditional. With two inputs, XOR is true if and only if the inputs differ (on ...
(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 "Pack My Box With Five Dozen Liquor Jugs" 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' <<< "Pack My Box With Five Dozen Liquor Jugs" Cnpx Zl Obk Jvgu Svir Qbmra Yvdhbe Whtf and the string "The Quick Brown Fox Jumps Over The Lazy Dog" for ROT47:


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 commands: , , or . In the Vim text editor, one can ROT13 a buffer with the command: .


Python

The module provides text transform. >>> import codecs >>> print(codecs.encode("The Quick Brown Fox Jumps Over The Lazy Dog", "rot13")) Gur Dhvpx Oebja Sbk Whzcf Bire Gur Ynml Qbt Without importing any libraries, it can be done by creating a translation table manually: >>> def gen_rot13_table(func=lambda x: x): ... for c in (ord("A"), ord("a")): ... for i in range(26): ... yield func(i + c), func((i + 13) % 26 + c) >>> table = dict(gen_rot13_table(chr)) >>> table {'A': 'N', 'B': 'O', 'C': 'P', 'D': 'Q', 'E': 'R', 'F': 'S', 'G': 'T', 'H': 'U', 'I': 'V', 'J': 'W', 'K': 'X', 'L': 'Y', 'M': 'Z', 'N': 'A', 'O': 'B', 'P': 'C', 'Q': 'D', 'R': 'E', 'S': 'F', 'T': 'G', 'U': 'H', 'V': 'I', 'W': 'J', 'X': 'K', 'Y': 'L', 'Z': 'M', 'a': 'n', 'b': 'o', 'c': 'p', 'd': 'q', 'e': 'r', 'f': 's', 'g': 't', 'h': 'u', 'i': 'v', 'j': 'w', 'k': 'x', 'l': 'y', 'm': 'z', 'n': 'a', 'o': 'b', 'p': 'c', 'q': 'd', 'r': 'e', 's': 'f', 't': 'g', 'u': 'h', 'v': 'i', 'w': 'j', 'x': 'k', 'y': 'l', 'z': 'm'} >>> >>> s = "Quartz glyph job vext cwm porshrop finks?!" >>> print("".join(table.get(c, c) for c in s)) Dhnegm tylcu wbo irkg pjz cbefuebc svaxf?! For Python 3, you can use the metho

(wit

: >>> x, y = zip(*gen_rot13_table(chr)) >>> ''.join(x) 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' >>> ''.join(y) 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm' >>> table = str.maketrans(''.join(x), ''.join(y)) >>> table {65: 78, 66: 79, 67: 80, 68: 81, 69: 82, 70: 83, 71: 84, 72: 85, 73: 86, 74: 87, 75: 88, 76: 89, 77: 90, 78: 65, 79: 66, 80: 67, 81: 68, 82: 69, 83: 70, 84: 71, 85: 72, 86: 73, 87: 74, 88: 75, 89: 76, 90: 77, 97: 110, 98: 111, 99: 112, 100: 113, 101: 114, 102: 115, 103: 116, 104: 117, 105: 118, 106: 119, 107: 120, 108: 121, 109: 122, 110: 97, 111: 98, 112: 99, 113: 100, 114: 101, 115: 102, 116: 103, 117: 104, 118: 105, 119: 106, 120: 107, 121: 108, 122: 109} >>> >>> print(s.translate(table)) Dhnegm tylcu wbo irkg pjz cbefuebc svaxf?!


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 se ...
*
Atbash Atbash (; 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 The Atbash ciph ...


References


External links


Online converter
for ROT13, ROT5, ROT18, ROT47,
Atbash Atbash (; 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 The Atbash ciph ...
and
Caesar cipher In cryptography, a Caesar cipher, also known as Caesar's cipher, the shift cipher, Caesar's code, or Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in t ...
.
ROT13 to Text on PureTables.com
{{DEFAULTSORT:Rot13 Classical ciphers Internet culture