Skip to content

Instantly share code, notes, and snippets.

View anilop702-code's full-sized avatar

anilop702-code

  • Joined Apr 18, 2026
View GitHub Profile
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: