Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using rot13 and tr command for having an encrypted email address

Tags:

shell

I have read many tutorials on the internet about the usage of the 'tr' command. However, I am not able to understand how to encrypt an email address with a shell script shift the characters using rot13. Can any one give a link or an example?

like image 937
Registered User Avatar asked Mar 26 '11 12:03

Registered User


People also ask

How do you use ROT13?

Description. Applying ROT13 to a piece of text merely requires examining its alphabetic characters and replacing each one by the letter 13 places further along in the alphabet, wrapping back to the beginning if necessary, preserving case: a becomes n, B becomes O, and so forth, down to Z, which becomes M.

What is ROT13 in Linux?

rot13 is a text scrambling method to prevent text from being accidentally read, such as the answer to a riddle or joke some might consider offensive. It works by shifting each character forward 13 times, so that A becomes N, B becomes O, etc.

How do you use tr in bash?

`tr` command can be used with -c option to replace those characters with the second character that don't match with the first character value. In the following example, the `tr` command is used to search those characters in the string 'bash' that don't match with the character 'b' and replace them with 'a'.


1 Answers

Not sure exactly how you want to use this, but here's a basic example to get you started:

echo '[email protected]' | tr 'A-Za-z' 'N-ZA-Mn-za-m' 

To make it easier, you can alias the tr command in your .bashrc file thusly:

alias rot13="tr 'A-Za-z' 'N-ZA-Mn-za-m'" 

Now you can just call:

echo '[email protected]' | rot13 
like image 192
samullen Avatar answered Oct 01 '22 15:10

samullen