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+=iprint(ans)
本文共 228 字,大约阅读时间需要 1 分钟。
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+=iprint(ans)
转载地址:http://woisl.baihongyu.com/