MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / main

Function main

ciphers/affine_cipher.py:85–102  ·  view source on GitHub ↗

>>> key = get_random_key() >>> msg = "This is a test!" >>> decrypt_message(key, encrypt_message(key, msg)) == msg True

()

Source from the content-addressed store, hash-verified

83
84
85def main() -> None:
86 """
87 >>> key = get_random_key()
88 >>> msg = "This is a test!"
89 >>> decrypt_message(key, encrypt_message(key, msg)) == msg
90 True
91 """
92 message = input("Enter message: ").strip()
93 key = int(input("Enter key [2000 - 9000]: ").strip())
94 mode = input("Encrypt/Decrypt [E/D]: ").strip().lower()
95
96 if mode.startswith("e"):
97 mode = "encrypt"
98 translated = encrypt_message(key, message)
99 elif mode.startswith("d"):
100 mode = "decrypt"
101 translated = decrypt_message(key, message)
102 print(f"\n{mode.title()}ed text: \n{translated}")
103
104
105if __name__ == "__main__":

Callers

nothing calls this directly

Calls 2

encrypt_messageFunction · 0.70
decrypt_messageFunction · 0.70

Tested by

no test coverage detected