def decrypt(self): # exact same as above function except in reverse cipher_object = AES.new( self.hashed_key_salt["key"], AES.MODE_CFB, self.hashed_key_salt["salt"] ) self.abort() # if the output file already exists, remove it first input_file = open(self.user_file, "rb") output_file = open(self.decrypt_output_file, "xb") done_chunks = 0 for piece in self.read_in_chunks(input_file): decrypted_content = cipher_object.decrypt(piece) output_file.write(decrypted_content) done_chunks += 1 yield done_chunks / self.total_chunks * 100 input_file.close() output_file.close() # clean up the cipher object del cipher_object