[go: nahoru, domu]

ROT13: Difference between revisions

Content deleted Content added
m →‎top: wikilink
GreenC bot (talk | contribs)
 
(29 intermediate revisions by 19 users not shown)
Line 1:
{{Short description|Simple encryption method|noreplace}}
{{Use dmy dates|date=FebruaryNovember 20222023}}
[[File:ROT13_table_with_example.svg|right|frameless]]
'''ROT13''' ('''Rotate13''', "'''rotate by 13 places'''", sometimes hyphenated '''ROT-13''') is a simple letter [[substitution cipher]] that replaces a letter with the 13th letter after it in the [[latinLatin 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 [[ISO basic Latin alphabet|basic Latin alphabet]], ROT13 is its own [[inverse function|inverse]]; that is, to undo ROT13, the same [[algorithm]] is applied, so the same action can be used for encoding and decoding. The algorithm provides virtually no [[cryptography|cryptographic]] security, and is often cited as a canonical example of [[weak encryption]].<ref name=modern-cryptanalysis>{{cite book |title=Modern Cryptanalysis: Techniques for Advanced Code Breaking |author=Christopher Swenson |page=5 |publisher=John Wiley & Sons |date=17 March 2008 |isbn=978-0-470-13593-8 |url=https://books.google.com/books?id=oLoaWgdmFJ8C&pg=PA5 |access-date=5 October 2015 |archive-date=24 June 2016 |archive-url=https://web.archive.org/web/20160624151537/https://books.google.com/books?id=oLoaWgdmFJ8C&pg=PA5 |url-status=live }}</ref>
 
ROT13 ishas been used in [[online forum]]s as a means of hiding [[spoiler (media)|spoiler]]s, [[punch line|punchlines]], puzzle solutions, and [[profanity|offensive material]]s from the casual glance. ROT13 has inspired a variety of letter and word games online, and is frequently mentioned in [[newsgroup]] conversations.
 
==Description==
Line 39:
ROT13 is a special case of the [[encryption algorithm]] known as a [[Caesar cipher]], used by [[Julius Caesar]] in the 1st century BC.<ref>{{Cite book|last=Kahn |first=David |author-link=David Kahn (writer) |title=The Codebreakers: The Story of Secret Writing |publisher=Macmillan |location=New York |isbn=0-684-83130-9 }}</ref>
 
[[Johann Ernst Elias Bessler]], an 18th -century clockmaker and constructor of [[perpetual motion]] machines, pointed out that ROT13 encodes his surname as ''Orffyre''. He used its [[latinisation of names|latinised]] form, ''Orffyreus'', as his pseudonym.<ref>{{cite web|url=https://lockhaven.edu/~dsimanek/museum/people/people.htm|title=Perpetual Futility: A short history of the search for perpetual motion|last=Simanek|first=Donald E.|date=2012|website=The Museum of Unworkable Devices|access-date=28 October 2020|archive-date=10 October 2020|archive-url=https://web.archive.org/web/20201010110525/https://www.lockhaven.edu/~dsimanek/museum/people/people.htm|url-status=live}}</ref>
 
ROT13 was in use in the net.jokes [[newsgroup]] by the early 1980s.{{efn|Early uses of ROT13 found in the Google USENET archive date back to 8 October 1982, posted to the <kbd>net.jokes</kbd> newsgroup.<ref>{{cite newsgroup |url=http://groups.google.com/groups?selm=bnews.desoto.299 |newsgroup=net.jokes |author=desoto!gog |date=8 October 1982 |title=very mildly obscence joke, shift=13 }}</ref><ref>{{cite newsgroup |url=http://groups.google.com/groups?selm=bnews.utcsrgv.596 |newsgroup=net.jokes |author=utcsrgv!dave |date=8 October 1982 |title=encrypted jokes}}</ref>}} It is used to hide potentially offensive jokes, or to obscure an answer to a puzzle or other [[spoiler (media)|spoiler]].<ref name="schneier"/><ref name="jargon">{{Cite web |date=29 December 2003 |editor-first=Eric S. |editor-last=Raymond |editor-link=Eric S. Raymond |url=http://www.catb.org/~esr/jargon/html/R/rot13.html |title=ROT13 |access-date=19 September 2007 |work=The Jargon File, 4.4.7 |archive-date=13 January 2012 |archive-url=https://web.archive.org/web/20120113164436/http://www.catb.org/~esr/jargon/html/R/rot13.html |url-status=live }}</ref>{{Unreliable source?|date=August 2018}} 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.<ref name="jargon"/> ROT13 is typically supported as a built-in feature to newsreadingnews reading software.<ref name="jargon"/> Email addresses are also sometimes encoded with ROT13 to hide them from less sophisticated [[spam bots]].<ref>{{cite web|last1=Ferner|first1=Matt|title=How to Hide Email Addresses From Spam Bots|date=9 December 2010|url=http://www.practicalecommerce.com/articles/2434-How-to-Hide-Email-Addresses-From-Spam-Bots|publisher=PracticalEcommerce|access-date=12 June 2014|archive-date=8 May 2016|archive-url=https://web.archive.org/web/20160508030142/http://www.practicalecommerce.com/articles/2434-How-to-Hide-Email-Addresses-From-Spam-Bots|url-status=live}}</ref>{{Dubious|date=September 2021}} 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.
Line 47:
ROT13 is not intended to be used where [[confidentiality|secrecy]] is of any concern—the use of a constant shift means that the encryption effectively has no [[key (cryptography)|key]], 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 (cryptanalysis)|frequency analysis]].<ref name="schneier"/> Because of its utter unsuitability for real secrecy, ROT13 has become a catchphrase to refer to any conspicuously weak [[encryption]] scheme; a critic might claim that "56-bit [[Data Encryption Standard|DES]] 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]], ROT26 is equivalent to no encryption at all), including a spoof academic paper entitled "On the 2ROT13 Encryption Algorithm".<ref>{{Cite web|title=On the 2ROT13 Encryption Algorithm|date=25 September 2004|url=http://www.pruefziffernberechnung.de/Originaldokumente/2rot13.pdf|publisher=Prüfziffernberechnung in der Praxis|access-date=20 September 2007|archive-date=15 April 2012|archive-url=https://web.archive.org/web/20120415092223/http://www.pruefziffernberechnung.de/Originaldokumente/2rot13.pdf|url-status=live}}</ref> By extension, triple-ROT13 (used in joking analogy with 3DES) is equivalent to regular ROT13.
 
In December 1999, it was found that [[Netscape Communicator]] used ROT13 as part of an insecure scheme to store email passwords.<ref>{{Cite CiteSeerX |author=Hollebeek, Tim|author2=Viega, John |author-link2=John Viega |title=Bad Cryptography in the Netscape Browser: A Case Study|citeseerx=10.1.1.15.9271 }}</ref> 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 Systems|Adobe]] eBook [[software development kit]]—for a serious encryption scheme.<ref>{{Cite web|first=Bruce|last=Perens|author-link=Bruce Perens|url=httphttps://www.zdnet.com/newsarticle/dimitry-sklyarov-enemy-or-friend/116424|title=Dimitry Sklyarov: Enemy or friend?|date=1 September 2001|access-date=3 February 2011|publisher=[[ZDNet News]]|archive-date=17 October 2014|archive-url=https://web.archive.org/web/20141017174003/http://www.zdnet.com/news/dimitry-sklyarov-enemy-or-friend/116424|url-status=live}}</ref> Windows XP uses ROT13 on some of its registry keys.<ref>{{Cite web|title=ROT13 is used in Windows|url=https://blog.didierstevens.com/2006/07/24/rot13-is-used-in-windows-you%E2%80%99re-joking/|date=24 July 2006|access-date=15 December 2016|archive-date=20 December 2016|archive-url=https://web.archive.org/web/20161220182919/https://blog.didierstevens.com/2006/07/24/rot13-is-used-in-windows-you%E2%80%99re-joking/|url-status=live}}</ref> ROT13 is also used in the [[fortune (Unix)|Unix fortune program]] to conceal potentially offensive [[dicta]].
 
==Letter games and net culture==
Line 84:
|}
 
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]] are ''[[wiktionary:abjurer|abjurer]]'' and ''nowhere'', and ''[[Chechen people|Chechen]]'' and ''[[wiktionary:purpura|purpura]]''. Other examples of words like these are shown in the table.<ref>{{Cite web|url=http://www.furrfu.org/rot13words.html|last=De Mulder|first=Tom|title=ROT13 Words|access-date=19 September 2007|work=Furrfu!|archive-date=2 April 2012|archive-url=https://web.archive.org/web/20120402095657/http://www.furrfu.org/rot13words.html|url-status=live}}</ref> The pair ''[[gnat]]'' and ''tang'' is an example of words that are both ROT13 reciprocals and reversals.
 
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 [[compiler|compiles]] correctly. Its operation, when executed, is either to perform ROT13 encoding on, or to reverse its input.<ref>{{Cite web | url = http://www.ioccc.org/1989/westley.c | title = westley.c | work = [[IOCCC]] | year = 1989 | first = Brian | last = Westley | access-date = 13 August 2007 | archive-date = 9 June 2012 | archive-url = https://web.archive.org/web/20120609004219/http://www.ioccc.org/1989/westley.c | url-status = live }}</ref>
Line 118:
 
=== Emacs and Vim ===
In [[Emacs]], one can ROT13 the buffer or a selection with the following commands:<ref>[https://www.gnu.org/software/emacs/manual/html_node/emacs/Rmail-Rot13.html "Rmail Rot13 – GNU Emacs Manual"] {{Webarchive|url=https://web.archive.org/web/20160324051316/https://www.gnu.org/software/emacs/manual/html_node/emacs/Rmail-Rot13.html |date=24 March 2016 }}. ''www.gnu.org''.</ref> <code>M-x toggle-rot13-mode</code>, <code>M-x rot13-other-window</code>, or <code>M-x rot13-region</code>.
<syntaxhighlight lang="text">
M-x toggle-rot13-mode
M-x rot13-other-window
M-x rot13-region
</syntaxhighlight>
 
and inIn the [[Vim (text editor)|Vim text editor]], one can ROT13 a buffer with the command:<ref>{{Cite web|archive-url=https://web.archive.org/web/20160303184604/http://rayninfo.co.uk/vimtips.html|url=http://rayninfo.co.uk/vimtips.html|title=Best of VIM Tips, gVIM's Key Features zzapper|archive-date=3 March 2016|date=3 March 2016|website=rayninfo.co.uk}}</ref> <code>ggg?G</code>.
 
ggg?G
 
===Python===
 
The module {{mono|codecs}} provides {{mono|'rot13'}} text transform.<ref>{{Cite web |urldate=https://docs.python.org/3/library/codecs.html#text-transforms2 November 2023 |title=codecs – Codec registry and base classes – Python 3.9.6 documentation |websiteurl=docshttps://ad.python.org|access/3/library/codecs.html#text-date=7transforms October 2020|archiveurl-datestatus=6 Octoberlive 2020|archive-url=https://web.archive.org/web/20201006065104/https://docs.python.org/3/library/codecs.html#text-transforms |urlarchive-statusdate=live6 October 2020 |access-date=7 October 2020 |website=ww6.python.org}}</ref>
 
<syntaxhighlight lang="pycon">
Line 138 ⟶ 131:
Gur Dhvpx Oebja Sbk Whzcf Bire Gur Ynml Qbt
</syntaxhighlight>
Without importing any libraries, it can be done within a two-line [[list comprehension]]:
<syntaxhighlight lang="python">
string = "Quartz glyph job vext cwm porchropporshrop finks?!"
 
for abcd in ["abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"]:
string = ''.join([abcd[(abcd.index(char) + 13) % 26] if char in abcd else char for char in string])
 
print(string)
 
# Dhnegm tylcu wbo irkg pjz cbepuebccbefuebc svaxf?!
</syntaxhighlight>