MCPcopy Create free account
hub / github.com/Huelse/SEAL-Python / pickle_example

Function pickle_example

examples/7_serialization.py:50–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

48
49
50def pickle_example():
51 print('pickle example')
52 print('-' * 70)
53 cipher1, context1, ckks_encoder1, decryptor1 = get_seal()
54 with open('cipher1.bin', 'wb') as f:
55 pickle.dump(cipher1.to_string(), f)
56 print('write cipher1 data success')
57
58 time.sleep(.5)
59
60 with open('cipher1.bin', 'rb') as f:
61 temp = pickle.load(f)
62 cipher2 = context1.from_cipher_str(temp)
63 plain2 = decryptor1.decrypt(cipher2)
64 data = ckks_encoder1.decode(plain2)
65 print('read cipher1 data success')
66 print(data)
67
68 print('-' * 70)
69
70
71if __name__ == "__main__":

Callers 1

7_serialization.pyFile · 0.85

Calls 1

get_sealFunction · 0.85

Tested by

no test coverage detected