Fun With Python: Cryptography Parody - The Dolphin Cipher 🐬

Hey everyone,

Today's "Fun with Python" post is less of a serious technical dive and more of a parody of the cryptographic ciphers we've been exploring recently. The other day, I came across a wonderfully funny article by Seth M. Larson called the "Scream Cipher."

The premise is simple but brilliant:

Today I learned there are more “Latin capital letter A” Unicode characters than there are letters in the English alphabet. You know what that means, it's time to scream 😱:

The author created a simple substitution cipher that replaces every letter of the alphabet with a different, obscure Unicode variant of the letter 'A'.

My Version: The Dolphin Cipher 🐬

I thought this was hilarious and decided to create my own variation, but with the letter 'E'. I'm calling it the Dolphin Cipher.

Why the Dolphin Cipher? Because the output, a long string of accented 'e's, looks a lot like the squeaks and clicks a dolphin might make.

Here you can see the original Scream Cipher in action, followed by my new Dolphin Cipher.

screenshot-20251006-081829.png

The Code

The script itself is a very simple substitution cipher, much like the Caesar cipher from our first post in this series. It just uses a dictionary to map each standard letter to a specific Unicode 'E' variant.

#!/usr/bin/env python3

import argparse

CIPHER = {
    "A": "É",
    "B": "Ĕ",
    "C": "Ě",
    "D": "Ȩ",
    "E": "Ḝ",
    "F": "Ê",
    "G": "Ế",
    "H": "Ệ",
    "I": "Ề",
    "J": "Ể",
    "K": "Ễ",
    "L": "Ḙ",
    "M": "Ë",
    "N": "Ė",
    "O": "Ẹ",
    "P": "Ȅ",
    "Q": "È",
    "R": "Ẻ",
    "S": "Ȇ",
    "T": "Ē",
    "U": "Ḗ",
    "V": "Ḕ",
    "W": "Ę",
    "X": "Ɇ",
    "Y": "Ẽ",
    "Z": "Ḛ",
}

CIPHER.update({k.lower(): v.lower() for k, v in CIPHER.items()})
UNCIPHER = {v: k for k, v in CIPHER.items()}


def dolphin_cipher(text, decrypt=False) -> str:
    """
    Applies the Dolphin cipher to a given text.
    Replaces letters with E variants for encryption.
    Handles both uppercase and lowercase letters, preserving case.
    Non-letter characters are left unchanged.
    :param text: The text to be processed.
    :param decrypt: If True, decrypts the text.
    :return: The processed text.
    """
    if not text:
        raise ValueError("Text cannot be empty.")

    if decrypt:
        return "".join(UNCIPHER.get(ch, ch) for ch in text)
    else:
        return "".join(CIPHER.get(ch, ch) for ch in text)


def main() -> None:
    parser = argparse.ArgumentParser(description="Dolphin Cipher")
    parser.add_argument("text", help="Text to encrypt/decrypt")
    parser.add_argument(
        "--decrypt", action="store_true", help="Decrypt instead of encrypt"
    )
    args = parser.parse_args()

    try:
        result = dolphin_cipher(args.text, args.decrypt)
        print(f"Result: {result}")
    except ValueError as e:
        print(f"Error: {e}")


if __name__ == "__main__":
    main()

It's silly, but I thought it was funny.

As always,
Michael Garcia a.k.a. TheCrazyGM

Sort:  

Hilarious, and I am imagining this script opening up a whole new line of dolphin translator gigs.

!PAKX
!PIMP
!PIZZA

View or trade PAKX tokens.

@ecoinstant, PAKX has voted the post by @thecrazygm. (1/2 calls)

Use !PAKX command if you hold enough balance to call for a @pakx vote on worthy posts! More details available on PAKX Blog.

I've come to love tech humor, and this is a good one! Thanks a lot for sharing this cute code play! 😁🙏💚✨🤙

PIZZA!

$PIZZA slices delivered:
@ecoinstant(1/20) tipped @thecrazygm

Come get MOONed!

This is great, eeee eeeeee eeeeee e ee eeee!