def load_cipher_array(self, size_file, binary_file): size_array = self.load_array(size_file) n = len(size_array) arr = np.empty(n, object) with open(binary_file, 'rb') as fp: for i in range(n): c = Ciphertext() element = fp.read(size_array[i]) with open('tmp_file', 'wb') as f: f.write(element) c.load(self._context, 'tmp_file') arr[i] = c os.remove('tmp_file') return arr
def load_encrypted_value(filepath: str) -> EncryptedValue: """Loads a saved encrypted value from the given file.""" ciphertext = Ciphertext() ciphertext.load(simplefhe._context, filepath) return EncryptedValue(ciphertext)