Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
distribute solution in Clear category for Scytale Encryption by karlian
from typing import Optional
def scytale_decipher(ciphertext: str, crib: str) -> Optional[str]:
distribute = lambda n: "".join(ciphertext[index::n] for index in range(n))
is_match = lambda text: crib in text
matches = filter(is_match, map(distribute, range(2, len(ciphertext))))
plaintext = next(matches, None)
return None if next(matches, False) else plaintext
June 14, 2022
Comments: