• 카이사르 암호 복호화 파이썬 코드

    2023. 7. 7.

    by. MinYuqShu

    반응형

    26개 다 나오는 카이사르 암호 복호화 파이썬 코드 ㅇㅅㅇ

    def caesar_cipher(message):
        for key in range(26):
            decrypted_message = ''
            for char in message:
                if char.isalpha():
                    ascii_offset = ord('A') if char.isupper() else ord('a')
                    decrypted_char = chr((ord(char) - ascii_offset + key) % 26 + ascii_offset)
                    decrypted_message += decrypted_char
                else:
                    decrypted_message += char
            print(f"Key {key}: {decrypted_message}")
    
    # 메시지 입력
    message = input("암호화된 메시지를 입력하세요: ")
    caesar_cipher(message)

    참 좋습니다

    다 나옵니당

     

    반응형

    '암호학' 카테고리의 다른 글

    SageMath ubuntu 설치  (0) 2023.10.22
    Textbook-RSA  (0) 2023.07.07
    XOR (Exclusive OR)  (0) 2023.07.06
    CryptoHack-Bytes and Big Integers  (0) 2023.07.06
    CryptoHack-base64  (0) 2023.07.06

    댓글