Python rot13加密
<div class="postcontent"><div id="cnblogs_post_body">http://zh.wikipedia.org/wiki/ROT13<div class="cnblogs_code"> 1 def rot13(s, OffSet=13): 2 def encodeCh(ch): 3 f=lambda x: chr((ord(ch)-x+OffSet) % 26 + x) 4 return f(97) if ch.islower() else (f(65) if ch.isupper() else ch) 5 return ''.join(encodeCh(c) for c in s) 6 7s='Hello!' 8print rot13(s) # Uryyb! 9print rot13(rot13(s)) # Hello!10print rot13(s,26) # Hello!
页:
[1]