pyfhel
PYthon For Homomorphic Encryption Libraries, perform encrypted computations such as sum, mult, scalar product or matrix multiplication in Python, with NumPy compatibility. Uses SEAL/PALISADE as backends, implemented using Cython.
Science Score: 54.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: scholar.google -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.1%) to scientific vocabulary
Keywords
Repository
PYthon For Homomorphic Encryption Libraries, perform encrypted computations such as sum, mult, scalar product or matrix multiplication in Python, with NumPy compatibility. Uses SEAL/PALISADE as backends, implemented using Cython.
Basic Info
- Host: GitHub
- Owner: ibarrond
- License: apache-2.0
- Language: Cython
- Default Branch: master
- Homepage: https://pyfhel.readthedocs.io/
- Size: 15.4 MB
Statistics
- Stars: 522
- Watchers: 11
- Forks: 84
- Open Issues: 12
- Releases: 8
Topics
Metadata Files
README.md


Python library for Addition, Subtraction, Multiplication and Scalar Product over encrypted integers (BFV/BGV schemes) and approximated floating point values (CKKS scheme). This library acts as an optimized Python API for C++ Homomorphic Encryption libraries.
| | |
|--------------------------------------------|--------------------------------------------------------------------------------------------|
| :flags: Language | Python (3.10+), with Cython and C++ ( :warning: requires a C++17 compiler :warning: ) |
| :computer: OS | Linux, Windows & MacOS. |
| :1234: Version | 3.5.0 (stable) |
| :books: Docs | In readthedocs! |
| :pencil2: Demos/Examples | In the docs with the outputs, sources in the examples folder. |
| :electricplug: Backends | SEAL, OpenFHE (WIP). Shipped alongside Pyfhel. |
| :constructionworker: Authors | Alberto Ibarrondo (IDEMIA & EURECOM) and Alexander Viand (ETH Zurich). |
| :mortar_board: Original Collaborators | Melek Onen (EURECOM), Laurent Gomez (SAP Labs). |
| | |
If you wish to cite Pyfhel in your derived work, please use the following BibTeX entry:
bibtex
@inproceedings{ibarrondo2021pyfhel,
title={Pyfhel: Python for homomorphic encryption libraries},
author={Ibarrondo, Alberto and Viand, Alexander},
booktitle={Proceedings of the 9th on Workshop on Encrypted Computing \& Applied Homomorphic Cryptography},
pages={11--16},
year={2021}
}
Install & Uninstall Summary Contributing Bugs & Feature Requests Legal Disclaimer
Install & Uninstall
To install Pyfhel from PyPI, run (WARNING! it takes several minutes to compile and install, be patient!):
bash
pip install Pyfhel
To install the latest version, you can clone this repository with all the submodules and install it by running:
bash
git clone --recursive https://github.com/ibarrond/Pyfhel.git
pip install .
To uninstall, just run:
bash
pip uninstall Pyfhel
With Docker
You can also use Docker to build and run Pyfhel. A Dockerfile is provided in the repository, which sets up the necessary environment. Check it up to configure python versions (default 3.12) and virtual environment location (default /home/venv). To build the image, just run:
bash
docker build --tag 'pyfhel-docker' .
To run the container interactively, you can use:
bash
docker run -it pyfhel-docker
Installing a C/C++ Compiler
Pyfhel requires a C/C++ compiler with C++17 support. We have tested:
- gcc6 to gcc14 in Linux/MacOS/Windows WSL. To install:
- Ubuntu: sudo apt install gcc g++
- MacOS: brew install gcc. MacOS users must also set several environment variables by running:
```bash
# Brew installs GCC in /opt/homebrew/bin on Apple Silicon and /usr/local/bin on Intel.
if [[ $(uname -m) = "arm64" ]]; then BREWGCCPATH="/opt/homebrew/bin"; else BREWGCCPATH="/usr/local/bin"; fi
# Set CC/CXX environment variables to the most recent GNU GCC
export CC="$BREW_GCC_PATH/$(ls $BREW_GCC_PATH | grep ^gcc-[0-9] | sort -V -r | head -n 1)"
export CXX="$BREW_GCC_PATH/$(ls $BREW_GCC_PATH | grep ^g++-[0-9] | sort -V -r | head -n 1)"
# Set MACOSX_DEPLOYMENT_TARGET to avoid version mismatch warnings
echo "MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion)" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=${{ env.MACOSX_DEPLOYMENT_TARGET }}"
``` - MSVC2017 and MSVC2019 in Windows. To install: - Install Visual C++ Build tools (Download here, guide in here)
Summary
PYthon For Homomorphic Encryption Libraries, Pyfhel implements functionalities of multiple Homomorphic Encryption libraries such as addition, multiplication, exponentiation or scalar product in Python. Pyfhel uses a syntax similar to normal arithmetics (+,-,*). This library is useful both for simple Homomorphic Encryption Demos as well as for complex problems such as Machine Learning algorithms.
Pyfhel is built on top of Afhel, an Abstraction Homomorphic Encryption Libraries in C++. Afhel serves as common API for all backends. Additionally, this project contains a large series of Demos & Tests for Pyfhel.
This repository contains:
- docs/ Documentation, generated automatically using sphinx and pushed to readthedocs.
- examples/ Demos and small programs to showcase multiple functionalities.
- Pyfhel/ contains the source code for Pyfhel and Afhel.
- Pyfhel/backend, underlying C++ libraries SEAL & PALISADE.
Contributing
This is the standard process to develop/contribute:
1. Code a new feature/fix a bug. Using Cython for the .pyx and .pxd extensions, C++ for Afhel or Python for examples/tests/other.
Build/Install Pyfhel locally. Use
pip install -v -v .for a verbose installation.Test changes (requires installing
pytest). Run the tests locally by executingpytest .in the root directory, and make sure all tests pass.
- Code coverage (requires installing
pytest-cov). Add an empty.covfile in the root directory, and build/install the project locally (pip install .). To run coverage tests, executepytest --cov .in the root directory, and thencoverage htmlto obtain a report.
You're ready to go! Just create a pull request to the original repo.
Bugs & Feature Requests
Please fill the Bug Report template to provide all the essential info to reproduce your issue and solve the problem.
If you wish to have new functionality added to Pyfhel, you are more than welcome to request it via the Feature template.
Legal disclaimer
This project is Open Source under the Apache V2 License (LICENSE file). Hence, Pyfhel can be used, modified, and copied freely provided that developers:
Acknowledge and mention the original authors of Pyfhel in any derived development, that is,
Alberto Ibarrondo (IDEMIA & EURECOM) and Alexander Viand (ETH Zurich)(maybe even cite the paper!).Maintain the same License, and provide a statement of changes.
We encourage any software using Pyfhel to be Open Source, for the benefit of everyone using it.
Owner
- Name: Alberto Ibarrondo
- Login: ibarrond
- Kind: user
- Location: Sophia Antipolis
- Company: IDEMIA
- Website: ibarrond.github.io
- Repositories: 4
- Profile: https://github.com/ibarrond
PhD fellow, Researcher on deep learning & secure computing @idemia & EURECOM
Citation (CITATION.bib)
@inproceedings{ibarrondo2021pyfhel,
title={Pyfhel: Python for homomorphic encryption libraries},
author={Ibarrondo, Alberto and Viand, Alexander},
booktitle={Proceedings of the 9th on Workshop on Encrypted Computing \& Applied Homomorphic Cryptography},
pages={11--16},
year={2021}
}
GitHub Events
Total
- Create event: 2
- Release event: 1
- Issues event: 21
- Watch event: 35
- Delete event: 1
- Issue comment event: 38
- Push event: 16
- Pull request event: 8
- Fork event: 4
Last Year
- Create event: 2
- Release event: 1
- Issues event: 21
- Watch event: 35
- Delete event: 1
- Issue comment event: 38
- Push event: 16
- Pull request event: 8
- Fork event: 4
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 27
- Total pull requests: 3
- Average time to close issues: 8 months
- Average time to close pull requests: 20 days
- Total issue authors: 25
- Total pull request authors: 3
- Average comments per issue: 1.07
- Average comments per pull request: 1.33
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 12
- Pull requests: 3
- Average time to close issues: 7 months
- Average time to close pull requests: 20 days
- Issue authors: 12
- Pull request authors: 3
- Average comments per issue: 0.67
- Average comments per pull request: 1.33
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- lilvmy (3)
- ShaneKosieradzki (2)
- cyber-titan (2)
- acklay4 (1)
- safiia (1)
- scutyuqiu (1)
- Rahn80643 (1)
- zhihanxu (1)
- reaneling (1)
- ShokofehVS (1)
- dunglee30 (1)
- huyvu1404 (1)
- Dyutighosh (1)
- danielbraun89 (1)
- Shakemilktea (1)
Pull Request Authors
- lilvmy (2)
- liaboveall (1)
- skriesch (1)
- healerTack (1)
- AlexanderViand (1)
- tanish-malekar (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
- Total downloads: unknown
-
Total dependent packages: 0
(may contain duplicates) -
Total dependent repositories: 0
(may contain duplicates) - Total versions: 14
proxy.golang.org: github.com/ibarrond/pyfhel
- Documentation: https://pkg.go.dev/github.com/ibarrond/pyfhel#section-documentation
- License: apache-2.0
-
Latest release: v3.4.3+incompatible
published 6 months ago
Rankings
proxy.golang.org: github.com/ibarrond/Pyfhel
- Documentation: https://pkg.go.dev/github.com/ibarrond/Pyfhel#section-documentation
- License: apache-2.0
-
Latest release: v3.4.3+incompatible
published 6 months ago
Rankings
Dependencies
- matplotlib *
- memory-profiler >=0.55
- sphinx >=3.2
- sphinx-gallery >=0.8
- sphinxcontrib-fulltoc >=1.2.0
- actions/checkout v3 composite
- actions/setup-python v3 composite
- codecov/codecov-action v3.1.0 composite
- ubuntu bionic build
- numpy >=1.21