How to encrypt a string with ROT13 (one liner)

ROT13 is a variation of the caesar chiffre. It replaces each letter with the letter 13 positions after that letter. A nice side effect: you need only a function to encrypt a string. If you encrypt an encrypted string, you’ll get the plaintext.

echo 'This is a Test' | tr 'A-Za-z' 'N-ZA-Mn-za-m'
Output: Guvf vf n Grfg

echo 'Guvf vf n Grfg' | tr 'A-Za-z' 'N-ZA-Mn-za-m'
Output: This is a Test

Posted on June 28, 2012, in Bash-Scripts, Cryptography and tagged , . Bookmark the permalink. 2 Comments.

  1. Thanks a lot. This helped me with one of my crypto missions on enigmagroup.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: