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

Method decrypt

ciphers/hill_cipher.py:122–135  ·  view source on GitHub ↗
(self, text)

Source from the content-addressed store, hash-verified

120 return self.toInt(self.modulus(inv_key))
121
122 def decrypt(self, text):
123 self.decrypt_key = self.makeDecryptKey()
124 text = self.processText(text.upper())
125 decrypted = ''
126
127 for i in range(0, len(text) - self.break_key + 1, self.break_key):
128 batch = text[i:i+self.break_key]
129 batch_vec = list(map(self.replaceLetters, batch))
130 batch_vec = numpy.matrix([batch_vec]).T
131 batch_decrypted = self.modulus(self.decrypt_key.dot(batch_vec)).T.tolist()[0]
132 decrypted_batch = ''.join(list(map(self.replaceNumbers, batch_decrypted)))
133 decrypted += decrypted_batch
134
135 return decrypted
136
137
138def main():

Callers 1

mainFunction · 0.95

Calls 2

makeDecryptKeyMethod · 0.95
processTextMethod · 0.95

Tested by

no test coverage detected