()
| 48 | |
| 49 | |
| 50 | def 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 | |
| 71 | if __name__ == "__main__": |
no test coverage detected