MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / main

Function main

ciphers/hill_cipher.py:193–213  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

191
192
193def main() -> None:
194 n = int(input("Enter the order of the encryption key: "))
195 hill_matrix = []
196
197 print("Enter each row of the encryption key with space separated integers")
198 for _ in range(n):
199 row = [int(x) for x in input().split()]
200 hill_matrix.append(row)
201
202 hc = HillCipher(np.array(hill_matrix))
203
204 print("Would you like to encrypt or decrypt some text? (1 or 2)")
205 option = input("\n1. Encrypt\n2. Decrypt\n")
206 if option == "1":
207 text_e = input("What text would you like to encrypt?: ")
208 print("Your encrypted text is:")
209 print(hc.encrypt(text_e))
210 elif option == "2":
211 text_d = input("What text would you like to decrypt?: ")
212 print("Your decrypted text is:")
213 print(hc.decrypt(text_d))
214
215
216if __name__ == "__main__":

Callers 1

hill_cipher.pyFile · 0.70

Calls 5

encryptMethod · 0.95
decryptMethod · 0.95
HillCipherClass · 0.85
splitMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected