To decode a rot13
encoded string, say s
, simply take rot13
of the string once again, i.e. compute rot13(s)
.
If you are not familiar how to compute rot13
in python, try googling a bit and you'll surely find one. I googled and found a solution that works pretty well : https://stackoverflow.com/a/3269756/3293087 [Note that it works only on python2 and not python3 since string.maketrans
was removed from python3.]
I'll write the code here for completeness :
# Python 2 solution
import string
rot13Table = string.maketrans(
"ABCDEFGHIJKLMabcdefghijklmNOPQRSTUVWXYZnopqrstuvwxyz",
"NOPQRSTUVWXYZnopqrstuvwxyzABCDEFGHIJKLMabcdefghijklm")
rot13 = lambda s : string.translate(s, rot13Table)
print rot13("Hello World!")
# Outputs "Uryyb Jbeyq!"
Note : I'm not going to write the decoded string corresponding to what the OP originally posted, since its quite offensive and homophobic. Anyone interested can do it themselves.
Update : I also found a solution that works for python 2 & 3 both from this SO answer. It turns out there is a builtin rot13
encoder in python in the codecs
module :
# Python 2 & 3 compatible
import codecs
rot13 = lambda s : codecs.getencoder("rot-13")(s)[0]
# Answer
rot13("Gur dhvpx oebja sbk whzcrq bire gur ynml qbt")
Update 2 : Since the OP is adamant to know the answer and does not seem to have python installed, I have a created JS solution https://codepen.io/anon/pen/zPYVQP. Others please proceed with caution.