X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=cipher%2Fhill.py;fp=cipher%2Fhill.py;h=8233de721231b5b4b2d1c2b3bafff982f48756e6;hb=eb9d341079d637d3af35c03b6fc02bfd0768bd43;hp=24bac7f986f3346f028e516bd69832a45ba015a8;hpb=4da6e4dc14ed17b99b3a51a180404e940570dcb8;p=cipher-tools.git diff --git a/cipher/hill.py b/cipher/hill.py index 24bac7f..8233de7 100644 --- a/cipher/hill.py +++ b/cipher/hill.py @@ -42,7 +42,7 @@ def hill_decipher(matrix, message, fillvalue='a'): 'hellothereaa' """ adjoint = linalg.det(matrix)*linalg.inv(matrix) - inverse_determinant = modular_division_table[int(round(linalg.det(matrix))) % 26][1] + inverse_determinant = modular_division_table[int(round(linalg.det(matrix))) % 26, 1] inverse_matrix = (inverse_determinant * adjoint) % 26 return hill_encipher(inverse_matrix, message, fillvalue)