Rot13

From Hackepedia
Revision as of 20:02, 9 October 2005 by Roy (talk | contribs)
Jump to navigationJump to search

Rot13 rotates all 26 letters of the alphabet by 13 positions rolling over to position 1 after position 26. A sample display of how rot13 "encrypts" is shown below:

$ echo A B C D E F G H I J K L M N O P Q R S T U V W X Y Z | rot13
       N O P Q R S T U V W X Y Z A B C D E F G H I J K L M

So you see A becomes N and N becomes A. This encryption can be found in many places online, such as Usenet and geocaching.com.

"But wait!", you say. "My system, has no 'rot13' program!" Fear not. It is but one line of Perl:

#!/usr/bin/perl -p
y/A-Za-z/N-ZA-Mn-za-m/;

(OK, two lines, if you count the shellexec header)