LinuxCommandLibrary

rot13

Obfuscate text with simple character substitution

SYNOPSIS

rot13 [file...]

DESCRIPTION

The `rot13` command is a simple substitution cipher that replaces each letter with the 13th letter after it in the alphabet. It's often used for obscuring text, like spoilers or potentially offensive content, making it easily readable by those who want to see it, while preventing accidental viewing. Since it's a reciprocal cipher (applying it twice returns the original text), it serves primarily as a form of obfuscation, not strong encryption.

The command operates by shifting each letter by 13 positions. For example, 'A' becomes 'N', 'B' becomes 'O', and so on. When it reaches the end of the alphabet, it wraps around to the beginning. Non-alphabetic characters are left unchanged. Note: Only the latin alphabet letters will be converted.

CAVEATS

The `rot13` command provides very weak security. It's not suitable for encrypting sensitive information. It's easily deciphered, especially with online tools or by applying rot13 again. Also, it does not support unicode correctly.

EXAMPLES

Example 1: Encoding a string:
$ echo "Hello World" | rot13
Uryyb Jbeyq

Example 2: Decoding (encoding again) the result from previous example:
$ echo "Hello World" | rot13 | rot13
Hello World

Example 3: Applying rot13 to a file:
$ rot13 input.txt > output.txt

HISTORY

The ROT13 cipher dates back to the early days of the internet, particularly within Usenet groups. It was used as a way to hide jokes, spoilers, and potentially offensive material. The command line utility `rot13` simply automates this process. The exact date of creation is difficult to pinpoint but it became a common tool in many Unix-like systems early on.

SEE ALSO

tr(1), sed(1), gpg(1)

Copied to clipboard