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

Function main

ciphers/hill_cipher.py:138–163  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

136
137
138def main():
139 N = int(input("Enter the order of the encryption key: "))
140 hill_matrix = []
141
142 print("Enter each row of the encryption key with space separated integers")
143 for i in range(N):
144 row = list(map(int, input().split()))
145 hill_matrix.append(row)
146
147 hc = HillCipher(numpy.matrix(hill_matrix))
148
149 print("Would you like to encrypt or decrypt some text? (1 or 2)")
150 option = input("""
1511. Encrypt
1522. Decrypt
153"""
154 )
155
156 if option == '1':
157 text_e = input("What text would you like to encrypt?: ")
158 print("Your encrypted text is:")
159 print(hc.encrypt(text_e))
160 elif option == '2':
161 text_d = input("What text would you like to decrypt?: ")
162 print("Your decrypted text is:")
163 print(hc.decrypt(text_d))
164
165
166if __name__ == "__main__":

Callers 1

hill_cipher.pyFile · 0.70

Calls 4

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

Tested by

no test coverage detected