What is Rot13?

From the Jargon File:

  • rot13 /rot ther'teen/ /n.,v./ [Usenet: from `rotate alphabet 13 places'] The simple Caesar-cypher encryption that replaces each English letter with the one 13 places forward or back along the alphabet, so that “The butler did it!” becomes “Gur ohgyre qvq vg!” Most Usenet news reading and posting programs include a rot13 feature. It is used to enclose the text in a sealed wrapper that the reader must choose to open – e.g., for posting things that might offend some readers, or spoilers. A major advantage of rot13 over rot(N) for other N is that it is self-inverse, so the same code can be used for encoding and decoding.

Converting text to/from rot13 with php.

And here's the code:

<p>Enter text to convert to/from rot13</p>
 <form action="rot13.php" method="get">
 <input type="text" name=string>
 <input type="submit">
 function rot13($s) {return !$s?"":strtr($s,"NnOoPpQqRrSsTtUuVvWwXxYyZzAaBbCcDdEeFfGgHhIiJjKkLlMm","AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz");}
if (isset($_GET['string']))
         $string = $_GET['string'];
         $rot = rot13($string);
              echo "<br><h4>$rot</h4>";

This is a modified version of code originally written by Boris Forman

tonybaldwin 2012.