()
| 136 | |
| 137 | |
| 138 | def 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(""" |
| 151 | 1. Encrypt |
| 152 | 2. 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 | |
| 166 | if __name__ == "__main__": |
no test coverage detected