Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
strings and chain solution in Clear category for Atbash Cipher by lxf42
from string import ascii_lowercase, ascii_uppercase
from itertools import chain
def atbash(plaintext: str) -> str:
table = {x[0]:x[1] for x in chain(zip(ascii_lowercase, reversed(ascii_lowercase)),
zip(ascii_uppercase, reversed(ascii_uppercase)))}
return "".join(table[x] if x in table else x for x in plaintext)
May 12, 2022