def edit(self, ciphertext, offset, new_text): plaintext = util.ctr_decrypt(ciphertext, self.key) new_plaintext = plaintext[:offset] + new_text + plaintext[offset+len(new_text):] return self.encrypt(new_plaintext)
def decrypt(self, text): return util.ctr_decrypt(text, self.key)
def edit(self, ciphertext, offset, new_text): plaintext = util.ctr_decrypt(ciphertext, self.key) new_plaintext = plaintext[:offset] + new_text + plaintext[ offset + len(new_text):] return self.encrypt(new_plaintext)