ciphers.fractionated_morse_cipher

Python program for the Fractionated Morse Cipher.

The Fractionated Morse cipher first converts the plaintext to Morse code, then enciphers fixed-size blocks of Morse code back to letters. This procedure means plaintext letters are mixed into the ciphertext letters, making it more secure than substitution ciphers.

http://practicalcryptography.com/ciphers/fractionated-morse-cipher/

Attributes

MORSE_CODE_DICT

MORSE_COMBINATIONS

REVERSE_DICT

plaintext

Functions

decrypt_fractionated_morse(→ str)

Decrypt a ciphertext message encrypted with Fractionated Morse Cipher.

encode_to_morse(→ str)

Encode a plaintext message into Morse code.

encrypt_fractionated_morse(→ str)

Encrypt a plaintext message using Fractionated Morse Cipher.

Module Contents

ciphers.fractionated_morse_cipher.decrypt_fractionated_morse(ciphertext: str, key: str) str

Decrypt a ciphertext message encrypted with Fractionated Morse Cipher.

Args:

ciphertext: The ciphertext message to decrypt. key: The decryption key.

Returns:

The decrypted plaintext message.

Example:
>>> decrypt_fractionated_morse("ESOAVVLJRSSTRX","Roundtable")
'DEFEND THE EAST'
ciphers.fractionated_morse_cipher.encode_to_morse(plaintext: str) str

Encode a plaintext message into Morse code.

Args:

plaintext: The plaintext message to encode.

Returns:

The Morse code representation of the plaintext message.

Example:
>>> encode_to_morse("defend the east")
'-..x.x..-.x.x-.x-..xx-x....x.xx.x.-x...x-'
ciphers.fractionated_morse_cipher.encrypt_fractionated_morse(plaintext: str, key: str) str

Encrypt a plaintext message using Fractionated Morse Cipher.

Args:

plaintext: The plaintext message to encrypt. key: The encryption key.

Returns:

The encrypted ciphertext.

Example:
>>> encrypt_fractionated_morse("defend the east","Roundtable")
'ESOAVVLJRSSTRX'
ciphers.fractionated_morse_cipher.MORSE_CODE_DICT
ciphers.fractionated_morse_cipher.MORSE_COMBINATIONS = ['...', '..-', '..x', '.-.', '.--', '.-x', '.x.', '.x-', '.xx', '-..', '-.-', '-.x', '--.',...
ciphers.fractionated_morse_cipher.REVERSE_DICT
ciphers.fractionated_morse_cipher.plaintext = 'defend the east'