;Task:
Implement a &nbsp; '''rot-13''' &nbsp; function &nbsp; (or procedure, class, subroutine, or other "callable" object as appropriate to your programming environment). 

Optionally wrap this function in a utility program &nbsp; (like [[:Category:Tr|tr]], &nbsp; which acts like a common [[UNIX]] utility, performing a line-by-line rot-13 encoding of every line of input contained in each file listed on its command line, &nbsp; or (if no filenames are passed thereon) acting as a filter on its &nbsp; "standard input." 


(A number of UNIX scripting languages and utilities, such as &nbsp; ''awk'' &nbsp; and &nbsp; ''sed'' &nbsp; either default to processing files in this way or have command line switches or modules to easily implement these wrapper semantics, e.g., &nbsp; [[Perl]] &nbsp; and &nbsp; [[Python]]).

The &nbsp; '''rot-13''' &nbsp; encoding is commonly known from the early days of Usenet "Netnews" as a way of obfuscating text to prevent casual reading of &nbsp; [[wp:Spoiler (media)|spoiler]] &nbsp; or potentially offensive material. 

Many news reader and mail user agent programs have built-in '''rot-13''' encoder/decoders or have the ability to feed a message through any external utility script for performing this (or other) actions.

The definition of the rot-13 function is to simply replace every letter of the ASCII alphabet with the letter which is "rotated" 13 characters "around" the 26 letter alphabet from its normal cardinal position &nbsp; (wrapping around from &nbsp; '''z''' &nbsp; to &nbsp; '''a''' &nbsp; as necessary). 

Thus the letters &nbsp; '''abc''' &nbsp; become &nbsp; '''nop''' &nbsp; and so on. 

Technically '''rot-13''' is a &nbsp; "mono-alphabetic substitution cipher" &nbsp; with a trivial &nbsp; "key". 

A proper implementation should work on upper and lower case letters, preserve case, and pass all non-alphabetic characters 
in the input stream through without alteration.


;Related tasks:
* &nbsp; [[Caesar cipher]]
* &nbsp; [[Substitution Cipher]]
* &nbsp; [[Vigenère Cipher/Cryptanalysis]]


{{Template:Strings}}
<br><br>

