Skip to content

Commit 1755567

Browse files
authored
Update hill_cipher.py
1 parent 3c4e968 commit 1755567

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ciphers/hill_cipher.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import string
2222

2323
import numpy as np
24+
2425
from maths.greatest_common_divisor import greatest_common_divisor
2526

2627

@@ -144,8 +145,8 @@ def check_determinant(self) -> None:
144145
ValueError: determinant modular 36 of encryption key(0) is not co prime
145146
w.r.t 36. Try another key.
146147
"""
147-
# 修复冗余的整数转换
148-
det = int(round(np.linalg.det(self.encrypt_key)))
148+
149+
det = round(np.linalg.det(self.encrypt_key))
149150

150151
if det < 0:
151152
det = det % len(self.key_string)
@@ -270,8 +271,8 @@ def make_decrypt_key(self) -> np.ndarray:
270271
ValueError: determinant modular 36 of encryption key(0) is not co prime
271272
w.r.t 36. Try another key.
272273
"""
273-
# 修复冗余的整数转换
274-
det = int(round(np.linalg.det(self.encrypt_key)))
274+
275+
det = round(np.linalg.det(self.encrypt_key))
275276

276277
if det < 0:
277278
det = det % len(self.key_string)

0 commit comments

Comments
 (0)