Decoding ROT using the Echo and Tr Command in the Terminal

cmatrix in Linux

In this tutorial we will use the ‘echo’ and ‘tr’ commands in order to encode and decode letters using ROT which is known as the Caesar Cipher. ROT means ROTation thus it is used to encode letters in the alphabet to its next letter. There are 25 possible ROT settings which covers the scope of letters A-Z. Thus in ROT-1, A is equals to B and B is equals to C and so are the next letters but Z would go back to A. And so the ROT-1 cipher of ‘ProjectX‘ is ‘QspkfduY‘.

The ‘echo’ command  is a built-in command in Bash in C shells which repeats the letters of words after it. For example:

echo ‘ProjectX’

echo commandIt would echo the word “ProjectX”=). Thus, the command is used to write its arguments to standard output.

Another command that we will be using is the tr command which translates characters. I saw in pastebin different implementations in different programming languages to decode ROT and that most of them are using the TR application so why not mixed it with the echo command? Alright here it goes, for example QspkfduY is ROT-1 and so I can decode it using echo “QspkfduY” | tr ‘b-za-aB-ZA-A’ ‘a-zA-Z’.

ROT-1 decoding

To decode the ROT-2 ProjectX which is “RtqlgevZ”, I can just change “b-za-aB-ZA-A” to “c-za-bC-ZA-B”.

rot-2 decoding

 This list should help you to decode ROT-3 to ROT-25:

ROT-3 = d-za-cD-ZA-C
ROT-4 = e-za-dE-ZA-D
ROT-5 =  f-za-eF-ZA-E
ROT-6 =  g-za-fG-ZA-F
ROT-7 = h-za-gH-ZA-G
ROT-8 = i-za-hI-ZA-H
ROT-9 = j-za-iJ-ZA-I
ROT-10 = k-za-jK-ZA-J
ROT-11 = l-za-kL-ZA-K
ROT-12 = m-za-lM-ZA-L
ROT-13 = n-za-mN-ZA-M
ROT-14 = o-za-nO-ZA-N
ROT-15 = p-za-oP-ZA-O
ROT-16 = q-za-pQ-ZA-P
ROT-17 = r-za-qR-ZA-Q
ROT-18 = s-za-rS-ZA-R
ROT-19 = t-za-sT-ZA-S
ROT-20 = u-za-tU-ZA-T
ROT-21 = v-za-uV-ZA-U
ROT-22 = w-za-vW-ZA-V
ROT-23 = x-za-wX-ZA-W
ROT-24 = y-za-xY-ZA-X
ROT-25 = z-za-yZ-ZA-Y

During ROOTCON 5 (5th Philippine Hackers Conference), Badge Decryption was one of the con games wherein the message was encoded in QR code and ROT-16 and that the blogger of underqualified.net got it,  so if another ROT Decryption is still on the loose during the con, you might try this if you are a Linux user. ;)

Decoding ROT using the Echo and Tr Command in the Terminal, Blog, using, command, Echo, terminal, Decoding

Decoding ROT using the Echo and Tr Command in the Terminal, Blog, using, command, Echo, terminal, Decoding

View full post on ProjectX Blog – Information Security Redefined

View full post on National Cyber Security » Computer Hacking