This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RU_SHORT = "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ" | |
| EN_SHORT = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
| ALLOWED_SYMBOLS = ".,!?;:'\"-()[]{}/\\@#$%^&*+=~`<>0123456789 \n" | |
| POLYBIUS_ALPHABETS = {'ru': RU_SHORT, 'en': EN_SHORT} | |
| POLYBIUS_SQUARE_SIZE = {'ru': (6, 6), 'en': (5, 5)} | |
| def caesar_cipher(text, shift, alphabet, mode): | |
| result = "" | |
| actual_shift = shift if mode == 'encrypt' else -shift | |
| for char in text: |