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

Method replace_digits

ciphers/hill_cipher.py:74–84  ·  view source on GitHub ↗

>>> hill_cipher = HillCipher(np.array([[2, 5], [1, 6]])) >>> hill_cipher.replace_digits(19) 'T' >>> hill_cipher.replace_digits(26) '0' >>> hill_cipher.replace_digits(26.1) '0'

(self, num: int)

Source from the content-addressed store, hash-verified

72 return self.key_string.index(letter)
73
74 def replace_digits(self, num: int) -> str:
75 """
76 >>> hill_cipher = HillCipher(np.array([[2, 5], [1, 6]]))
77 >>> hill_cipher.replace_digits(19)
78 'T'
79 >>> hill_cipher.replace_digits(26)
80 '0'
81 >>> hill_cipher.replace_digits(26.1)
82 '0'
83 """
84 return self.key_string[int(num)]
85
86 def check_determinant(self) -> None:
87 """

Callers 2

encryptMethod · 0.95
decryptMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected