message_cipher.modulo26_cipher module
Modulo 26 Cipher module.
This module defines the Mod26Cipher class, which is an abstract base class for implementing ciphers that operate on the modulo 26 alphabet.
- class message_cipher.modulo26_cipher.Mod26Cipher
Bases:
Cipher
Modulo 26 Cipher.
Abstract Cipher class that operates exclusively on the english alphabet. Performs calculations to encrypt strings into ciphertext and then decrypt encrypted strings back to the original alphabet.
- NUMBER_OF_LETTERS_IN_ALPHABET = 26
- decrypt(ciphertext: str) str
Decrypts the encrypted message using the cipher.
- Parameters:
ciphertext (str) – An encrypted message to decrypt.
- Returns:
The decrypted message as a string.
- Return type:
str
- encrypt(plaintext: str) str
Encrypts a message using the cipher.
- Parameters:
plaintext (str) – A string message to be encrypted.
- Returns:
The encrypted message as a string.
- Return type:
str