ROT13 cipher(read as – “rotate by 13 places”) is a special case of the Caesar cipher in which the shift is always 13.
So every letter is shifted 13 places to encrypt or to decrypt the message.
You must think that it is just another caesar cipher so what’s different this time? Well the difference is in its implementation. The approach is to use two separate python dictionaries.
- First one to lookup the various letters according to their place in the English alphabets to get the shifted number
- Second one to get the letters which correspond to those shifted numbers.
Output : TRRXF SBE TRRXF GEEKS FOR GEEKS
Analysis: The ROT13 cipher is not very secure as it is just a special case of the Caesar cipher. The Caesar cipher can be broken by either frequency analysis or by just trying out all 25 keys whereas the ROT13 cipher can be broken by just shifting the letters 13 places. Therefore it has no practical use.
Application: ROT13 was in use in the net.jokes newsgroup by the early 1980s.
This article is contributed by Palash Nigam . If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.