https://github.com/accenture/pyheal
PyHeal is a Python wrapper for Microsoft SEAL aimed at making operations easier to use.
https://github.com/accenture/pyheal
Last synced: 3 months ago
JSON representation
PyHeal is a Python wrapper for Microsoft SEAL aimed at making operations easier to use.
- Host: GitHub
- URL: https://github.com/accenture/pyheal
- Owner: Accenture
- License: mit
- Created: 2019-07-26T10:20:13.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-04-23T03:47:30.000Z (about 6 years ago)
- Last Synced: 2025-09-08T23:14:10.727Z (9 months ago)
- Language: Python
- Homepage:
- Size: 64.5 KB
- Stars: 15
- Watchers: 4
- Forks: 7
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pyHeal

This project implements Python wrappers for Homomorphic Encryption libraries, aimed at being more Python friendly.
It currently contains:
- A pybind11 based Python wrapper for [Microsoft SEAL](https://github.com/CJRChang/SEAL) in `seal_wrapper`
- A Pythonic wrapper for `seal_wrapper` in `pyheal/wrapper.py`
- A Python ciphertext type of object that allows math operations as if they were python numbers in `pyheal/ciphertext_op.py`
- A standard encoder/decoder interface for seal encoders and encryptors for use of the `CiphertextOp` objects in `pyheal/encoders.py`.
Tests:
- A partial re-implementation of [Microsoft SEAL's examples](https://github.com/CJRChang/SEAL) using `wrapper.py` in `tests.py`
- A large number of tests for PyHEAL and `CiphertextOp` in `pyheal/test_pyheal.py`
# Setup
Clone using:
Git v2.13+: `git clone --recurse-submodules https://github.com/Accenture/pyheal.git`
Git v1.6.5 - v2.12: `git clone --recursive https://github.com/Accenture/pyheal.git`
For a repository that has already been cloned or older versions of git run:
`git submodule update --init --recursive`
## Build
This project can be built directly using `pip3`.
Optionally create and activate a new Python virtual environment using `virtualenv` first, for example:
```bash
python3 -m virtualenv ./venv --python python3
#Linux
source ./venv/bin/activate
#Windows
#venv\Scripts\activate
```
Install dependencies and package:
```bash
pip3 install .
```
# Usage
```python
import pyheal
# Set encryption params + obtain an EncryptorOp object
...
encryptor = EncryptorOp(...)
decryptor = Decryptor(...)
v1 = encryptor.encode(10)
v2 = encryptor.encode(20)
result = v1 + v2
print(decryptor.decrypt(result)) # Prints 30 after decrypt
```
See [example_usage.py](example_usage.py) for more usage examples.