Rot13是一种非常简单的替换加密算法,只能加密26个英语字母。方法是:把每个字母用其后第13个字母代替。 因为有26个字母,取其一半13。
s = "xrlvf23xfqwsxsqf" ans = "" for i in s: if 'a' <= i <= 'z': ans += chr(((ord(i)-ord('a')) + 13) % 26 + ord('a')) else: ans+=i print(ans)