Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Atbash Cipher by R0bo7
import re
def func(s):
a = 'abcdefghijklmnopqrstuvwxyz'
A = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
s = s.group()
if s.isupper():
return A[::-1][A.index(s)]
else:
return a[::-1][a.index(s)]
def atbash(plaintext: str) -> str:
return re.sub(r'[a-zA-Z]' , func, plaintext)
Jan. 17, 2022