Pyfhel


NamePyfhel JSON
Version 3.4.2 PyPI version JSON
download
home_pagehttps://pyfhel.readthedocs.io
SummaryPython for Homomorphic Encryption Libraries
upload_time2023-09-20 22:34:24
maintainer
docs_urlNone
authorAlberto Ibarrondo, Alexander Viand
requires_python>=3.7
licenseGNU GPLv3
keywords homomorphic encryption cython cryptography
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <img width="70%" align="left"  src="/docs/static/logo_title.png"><img width="17%" height="17%" align="right"  src="/docs/static/logo.png">

[![iCodecov](https://codecov.io/gh/ibarrond/Pyfhel/branch/master/graph/badge.svg?token=S8J8Jlp1Fc)](https://codecov.io/gh/ibarrond/Pyfhel)
[![Documentation Status](https://readthedocs.org/projects/pyfhel/badge/?version=latest)](https://pyfhel.readthedocs.io/en/latest/?badge=latest)
[![PyPI version](https://badge.fury.io/py/Pyfhel.svg)](https://badge.fury.io/py/Pyfhel)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-brightgreen.svg)](https://GitHub.com/ibarrond/Pyfhel/graphs/commit-activity)
[![GitHub issues](https://img.shields.io/github/issues/ibarrond/Pyfhel.svg)](https://github.com/ibarrond/Pyfhel/issues)
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)


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.7+), with Cython and C++ (:warning: _requires a [C++17 compiler][3]_ :warning:.) |
| :computer: **OS**                          | Linux, Windows & MacOS.                                                                    |
| :1234: **Version** | 3.4.2 (stable)                                                                                                     |
| :books: **Docs**                           | In [readthedocs][1]!                                                                       |
| :pencil2: **Demos/Examples**               | [In the docs][4] with the outputs, sources in the [`examples`][2] folder.                  |
| :electric_plug: **Backends**               | [SEAL][5], [OpenFHE (WIP)][6]. Shipped alongside Pyfhel.                                   |
| :construction_worker: **Authors**          | [Alberto Ibarrondo][7] (IDEMIA & EURECOM) and [Alexander Viand][8] (ETH Zurich).           |
| :mortar_board: **Original Collaborators**  | [Melek Onen][9] (EURECOM), [Laurent Gomez][10] (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}
}
```

[1]:https://pyfhel.readthedocs.io/en/latest/
[2]:https://github.com/ibarrond/Pyfhel/tree/master/examples
[3]:https://en.cppreference.com/w/cpp/compiler_support
[4]:https://pyfhel.readthedocs.io/en/latest/_autoexamples/index.html
[5]:https://github.com/microsoft/SEAL/
[6]:https://github.com/openfheorg/openfhe-development
[7]:https://scholar.google.com/citations?hl=en&user=hl-5WRQAAAAJ
[8]:https://pps-lab.com/people/alexanderviand/
[9]:http://www.eurecom.fr/~onen/
[10]:https://scholar.google.com/citations?user=QJv4B9EAAAAJ

  <br />

-------------
[`Install & Uninstall`](#install--uninstall)&ensp; [`Summary`](#summary)&ensp; [`Contributing`](#contributing)&ensp; [`Bugs & Feature Requests`](#bugs--feature-requests)&ensp; [`Legal Disclaimer`](#legal-disclaimer)

-------------
<br />

## Install & Uninstall
To install `Pyfhel` from [PyPI](https://pypi.org/project/Pyfhel/), 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](https://stackoverflow.com/questions/3796927/how-to-git-clone-including-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
```

### Installing a C/C++ Compiler
`Pyfhel` requires a C/C++ compiler with C++17 support. We have tested:
- *gcc6* to *gcc12* 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 BREW_GCC_PATH="/opt/homebrew/bin"; else BREW_GCC_PATH="/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](https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170), guide in [here](https://stackoverflow.com/questions/40504552))

## Summary
**PY**thon **F**or **H**omomorphic **E**ncryption **L**ibraries, **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 **A**bstraction **H**omomorphic **E**ncryption **L**ibraries 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](https://pyfhel.readthedocs.io).
- `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](https://cython.readthedocs.io/en/latest/) for the `.pyx` and `.pxd` extensions, C++ for `Afhel` or Python for examples/tests/other.

2. _Build/Install Pyfhel locally_. Use `pip install -v -v -v .` for a verbose installation.

3. _Test changes (requires installing `pytest`)_. Run the tests locally by executing `pytest .`  in the root directory, and make sure all tests pass. 
	
   - _Code coverage (requires installing `pytest-cov`)_. Add an empty `.cov` file in the root directory, and build/install the project locally (`pip install .`). To run coverage tests, execute `pytest --cov .` in the root directory, and then `coverage html` to 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**](https://github.com/ibarrond/Pyfhel/issues/new/choose) 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**](https://github.com/ibarrond/Pyfhel/issues/new/choose) template.

## Legal disclaimer
This project is Open Source under the GNU GPLv3 License (LICENSE file). Hence, Pyfhel can be used, modified, and copied freely provided that developers:

   1. 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!).

   2. Offer the exact same License, allowing legal permission to copy, distribute and/or modify any SW using Pyfhel. Hence, **any software using Pyfhel must remain Open Source**.

            

Raw data

            {
    "_id": null,
    "home_page": "https://pyfhel.readthedocs.io",
    "name": "Pyfhel",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "homomorphic,encryption,cython,cryptography",
    "author": "Alberto Ibarrondo, Alexander Viand",
    "author_email": "Alberto Ibarrondo <ibarrond@eurecom.fr>, Alexander Viand <alexander.viand@inf.ethz.ch>",
    "download_url": "https://files.pythonhosted.org/packages/2d/34/c6b1563a4c7a0fa940e5c9bfd521048bc936236e34deeb7f28cae71bf2d7/Pyfhel-3.4.2.tar.gz",
    "platform": "Linux",
    "description": "<img width=\"70%\" align=\"left\"  src=\"/docs/static/logo_title.png\"><img width=\"17%\" height=\"17%\" align=\"right\"  src=\"/docs/static/logo.png\">\n\n[![iCodecov](https://codecov.io/gh/ibarrond/Pyfhel/branch/master/graph/badge.svg?token=S8J8Jlp1Fc)](https://codecov.io/gh/ibarrond/Pyfhel)\n[![Documentation Status](https://readthedocs.org/projects/pyfhel/badge/?version=latest)](https://pyfhel.readthedocs.io/en/latest/?badge=latest)\n[![PyPI version](https://badge.fury.io/py/Pyfhel.svg)](https://badge.fury.io/py/Pyfhel)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-brightgreen.svg)](https://GitHub.com/ibarrond/Pyfhel/graphs/commit-activity)\n[![GitHub issues](https://img.shields.io/github/issues/ibarrond/Pyfhel.svg)](https://github.com/ibarrond/Pyfhel/issues)\n[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n\n\nPython 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.\n\n|                                            |                                                                                            |\n|--------------------------------------------|--------------------------------------------------------------------------------------------|\n| :flags: **Language**                       | Python (3.7+), with Cython and C++ (:warning: _requires a [C++17 compiler][3]_ :warning:.) |\n| :computer: **OS**                          | Linux, Windows & MacOS.                                                                    |\n| :1234: **Version** | 3.4.2 (stable)                                                                                                     |\n| :books: **Docs**                           | In [readthedocs][1]!                                                                       |\n| :pencil2: **Demos/Examples**               | [In the docs][4] with the outputs, sources in the [`examples`][2] folder.                  |\n| :electric_plug: **Backends**               | [SEAL][5], [OpenFHE (WIP)][6]. Shipped alongside Pyfhel.                                   |\n| :construction_worker: **Authors**          | [Alberto Ibarrondo][7] (IDEMIA & EURECOM) and [Alexander Viand][8] (ETH Zurich).           |\n| :mortar_board: **Original Collaborators**  | [Melek Onen][9] (EURECOM), [Laurent Gomez][10] (SAP Labs).                                 |\n|                                            |                                                                                            |\n\n\nIf you wish to cite Pyfhel in your derived work, please use the following BibTeX entry:\n```bibtex\n  @inproceedings{ibarrondo2021pyfhel,\n  title={Pyfhel: Python for homomorphic encryption libraries},\n  author={Ibarrondo, Alberto and Viand, Alexander},\n  booktitle={Proceedings of the 9th on Workshop on Encrypted Computing \\& Applied Homomorphic Cryptography},\n  pages={11--16},\n  year={2021}\n}\n```\n\n[1]:https://pyfhel.readthedocs.io/en/latest/\n[2]:https://github.com/ibarrond/Pyfhel/tree/master/examples\n[3]:https://en.cppreference.com/w/cpp/compiler_support\n[4]:https://pyfhel.readthedocs.io/en/latest/_autoexamples/index.html\n[5]:https://github.com/microsoft/SEAL/\n[6]:https://github.com/openfheorg/openfhe-development\n[7]:https://scholar.google.com/citations?hl=en&user=hl-5WRQAAAAJ\n[8]:https://pps-lab.com/people/alexanderviand/\n[9]:http://www.eurecom.fr/~onen/\n[10]:https://scholar.google.com/citations?user=QJv4B9EAAAAJ\n\n  <br />\n\n-------------\n[`Install & Uninstall`](#install--uninstall)&ensp; [`Summary`](#summary)&ensp; [`Contributing`](#contributing)&ensp; [`Bugs & Feature Requests`](#bugs--feature-requests)&ensp; [`Legal Disclaimer`](#legal-disclaimer)\n\n-------------\n<br />\n\n## Install & Uninstall\nTo install `Pyfhel` from [PyPI](https://pypi.org/project/Pyfhel/), run (*WARNING! it takes several minutes to compile and install, be patient!*):\n```bash\npip install Pyfhel\n```\n\nTo install the latest version, you can clone this repository with [all the submodules](https://stackoverflow.com/questions/3796927/how-to-git-clone-including-submodules) and install it by running:\n```bash\ngit clone --recursive https://github.com/ibarrond/Pyfhel.git\npip install .\n```\n\nTo uninstall, just run:\n```bash\npip uninstall Pyfhel\n```\n\n### Installing a C/C++ Compiler\n`Pyfhel` requires a C/C++ compiler with C++17 support. We have tested:\n- *gcc6* to *gcc12* in Linux/MacOS/Windows WSL. To install:\n   - Ubuntu: `sudo apt install gcc g++`\n   - MacOS: `brew install gcc`. MacOS users must also set several environment variables by running:\n```bash\n        # Brew installs GCC in /opt/homebrew/bin on Apple Silicon and /usr/local/bin on Intel.\n        if [[ $(uname -m) = \"arm64\" ]]; then BREW_GCC_PATH=\"/opt/homebrew/bin\"; else BREW_GCC_PATH=\"/usr/local/bin\"; fi\n\n        # Set CC/CXX environment variables to the most recent GNU GCC\n        export CC=\"$BREW_GCC_PATH/$(ls $BREW_GCC_PATH | grep ^gcc-[0-9] | sort -V -r | head -n 1)\"\n        export CXX=\"$BREW_GCC_PATH/$(ls $BREW_GCC_PATH | grep ^g++-[0-9] | sort -V -r | head -n 1)\"\n        \n        # Set MACOSX_DEPLOYMENT_TARGET to avoid version mismatch warnings\n        echo \"MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion)\" >> $GITHUB_ENV\n        echo \"MACOSX_DEPLOYMENT_TARGET=${{ env.MACOSX_DEPLOYMENT_TARGET }}\"\n```\n- *MSVC2017* and *MSVC2019* in Windows. To install:\n   - Install Visual C++ Build tools (Download [here](https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170), guide in [here](https://stackoverflow.com/questions/40504552))\n\n## Summary\n**PY**thon **F**or **H**omomorphic **E**ncryption **L**ibraries, **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.\n\n**Pyfhel** is built on top of **Afhel**, an **A**bstraction **H**omomorphic **E**ncryption **L**ibraries in C++. **Afhel** serves as common API for all backends. Additionally, this project contains a large series of Demos & Tests for **Pyfhel**.\n\nThis repository contains:\n- `docs/` Documentation, generated automatically using sphinx and pushed to [readthedocs](https://pyfhel.readthedocs.io).\n- `examples/` Demos and small programs to showcase multiple functionalities.\n- `Pyfhel/` contains the source code for Pyfhel and Afhel.\n- `Pyfhel/backend`, underlying C++ libraries SEAL & PALISADE.\n\n\n## Contributing\nThis is the standard process to develop/contribute:\n1. _Code a new feature/fix a bug_. Using [Cython](https://cython.readthedocs.io/en/latest/) for the `.pyx` and `.pxd` extensions, C++ for `Afhel` or Python for examples/tests/other.\n\n2. _Build/Install Pyfhel locally_. Use `pip install -v -v -v .` for a verbose installation.\n\n3. _Test changes (requires installing `pytest`)_. Run the tests locally by executing `pytest .`  in the root directory, and make sure all tests pass. \n\t\n   - _Code coverage (requires installing `pytest-cov`)_. Add an empty `.cov` file in the root directory, and build/install the project locally (`pip install .`). To run coverage tests, execute `pytest --cov .` in the root directory, and then `coverage html` to obtain a report.\n\nYou're ready to go! Just create a pull request to the original repo.\n\n## Bugs & Feature Requests\nPlease fill the [**Bug Report**](https://github.com/ibarrond/Pyfhel/issues/new/choose) template to provide all the essential info to reproduce your issue and solve the problem.\n\nIf you wish to have new functionality added to Pyfhel, you are more than welcome to request it via the [**Feature**](https://github.com/ibarrond/Pyfhel/issues/new/choose) template.\n\n## Legal disclaimer\nThis project is Open Source under the GNU GPLv3 License (LICENSE file). Hence, Pyfhel can be used, modified, and copied freely provided that developers:\n\n   1. 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!).\n\n   2. Offer the exact same License, allowing legal permission to copy, distribute and/or modify any SW using Pyfhel. Hence, **any software using Pyfhel must remain Open Source**.\n",
    "bugtrack_url": null,
    "license": "GNU GPLv3",
    "summary": "Python for Homomorphic Encryption Libraries",
    "version": "3.4.2",
    "project_urls": {
        "Download": "https://github.com/ibarrond/github",
        "Homepage": "https://pyfhel.readthedocs.io",
        "documentation": "https://pyfhel.readthedocs.io",
        "repository": "https://github.com/ibarrond/github"
    },
    "split_keywords": [
        "homomorphic",
        "encryption",
        "cython",
        "cryptography"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2d34c6b1563a4c7a0fa940e5c9bfd521048bc936236e34deeb7f28cae71bf2d7",
                "md5": "0234211b5754a7e2665bd4bc53b7dbf2",
                "sha256": "fa41664f8815b27f6347821f6363a7516fa84f50570816d8f292f2c22f88f88c"
            },
            "downloads": -1,
            "filename": "Pyfhel-3.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "0234211b5754a7e2665bd4bc53b7dbf2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 1033065,
            "upload_time": "2023-09-20T22:34:24",
            "upload_time_iso_8601": "2023-09-20T22:34:24.522873Z",
            "url": "https://files.pythonhosted.org/packages/2d/34/c6b1563a4c7a0fa940e5c9bfd521048bc936236e34deeb7f28cae71bf2d7/Pyfhel-3.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-20 22:34:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ibarrond",
    "github_project": "github",
    "github_not_found": true,
    "lcname": "pyfhel"
}
        
Elapsed time: 2.61864s