A (very) simple method of encryption
ROT-13 (rotate 13) is a simple text encoding technique, a variation on the Caesar cypher used by the ancient Romans. To encode a message in ROT-13, simply replace each letter by the letter 13 positions after it in the alphabet (when you pass "Z", just go back to "A" and continue.)
By choosing 13 as the offset, the code is self-decrypting, which makes it very simple to program for use on computers. To encode a message, you run the message through the encoder. To decode, you simply run the encoded message through the same decoder again.
Contents at a Glance
The Table
ROT-13 Lookup Table For Manual Decoding
Encryption 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
Available Decoders
A Java version is included in the lens.
Many newsreader programs had the ROT-13 decoder built-in, since it was a standard way to publish "spoilers" without printing the text where it could be easily stumbled across. If you marked a section as a spoiler and rot-13'd the text, then the reader would have to take an action in order to decode the text.
Sample Java Code
This is not optimized code but it works.
public class Rot13
{
public static String rot13(String message)
{
String coded = "";
for (int x = 0; x < message.length(); x++)
{
char c = message.charAt(x);
if (Character.isLowerCase(c))
{
c += 13;
if (c > 'z')
c -= ('z' - 'a') + 1;
}
if (Character.isUpperCase(c))
{
c += 13;
if (c > 'Z')
c -= ('Z' - 'A') + 1;
}
coded += c;
}
return coded;
}
}
Related
Some Uses
A Real-World Example
ROT-13 can be a useful method to create "cool-sounding" user names. I used it in a (rather) futile effort to impress my son when he was about five.For example, "Kevin" becomes "xriva" which I have used as a name for my personal website at www.xriva.com.
I have received notes from other Kevins because I registered "xriva" first, so apparently I'm not the only one who thought of this.
Cryptography Books
by SparkyDad
pets find... (more)






