(self, text)
| 80 | raise ValueError("discriminant modular {0} of encryption key({1}) is not co prime w.r.t {2}.\nTry another key.".format(req_l, det, req_l)) |
| 81 | |
| 82 | def processText(self, text): |
| 83 | text = list(text.upper()) |
| 84 | text = [char for char in text if char in self.key_string] |
| 85 | |
| 86 | last = text[-1] |
| 87 | while len(text) % self.break_key != 0: |
| 88 | text.append(last) |
| 89 | |
| 90 | return ''.join(text) |
| 91 | |
| 92 | def encrypt(self, text): |
| 93 | text = self.processText(text.upper()) |