concrete-numpy


Nameconcrete-numpy JSON
Version 0.10.0 PyPI version JSON
download
home_pagehttps://zama.ai/concrete/
SummaryConcrete Numpy is an open-source library which simplifies the use of fully homomorphic encryption (FHE).
upload_time2023-01-31 09:58:43
maintainer
docs_urlNone
authorZama
requires_python>=3.7,<3.11
licenseBSD-3-Clause
keywords fhe homomorphic encryption privacy security
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
<!-- product name logo -->
  <img width=600 src="https://user-images.githubusercontent.com/5758427/193612313-6b1124c7-8e3e-4e23-8b8c-57fd43b17d4f.png">
</p>

<p align="center">
<!-- Version badge using shields.io -->
  <a href="https://github.com/zama-ai/concrete-numpy/releases">
    <img src="https://img.shields.io/github/v/release/zama-ai/concrete-numpy?style=flat-square">
  </a>
<!-- Link to docs badge using shields.io -->
  <a href="https://docs.zama.ai/concrete-numpy/">
    <img src="https://img.shields.io/badge/read-documentation-yellow?style=flat-square">
  </a>
<!-- Community forum badge using shields.io -->
  <a href="https://community.zama.ai/c/concrete-numpy">
    <img src="https://img.shields.io/badge/community%20forum-online-brightgreen?style=flat-square">
  </a>
<!-- Open source badge using shields.io -->
  <a href="https://docs.zama.ai/concrete-numpy/developer/contributing">
    <img src="https://img.shields.io/badge/we're%20open%20source-contributing.md-blue?style=flat-square">
  </a>
<!-- Follow on twitter badge using shields.io -->
  <a href="https://twitter.com/zama_fhe">
    <img src="https://img.shields.io/badge/follow-zama_fhe-blue?logo=twitter&style=flat-square">
  </a>
</p>


**Concrete Numpy** is an open-source library which simplifies the use of fully homomorphic encryption (FHE) in Python.

FHE is a powerful cryptographic tool, which allows computation to be performed directly on encrypted data without needing to decrypt it first.

With FHE, you can build services that preserve the privacy of the users. FHE is also great against data breaches as everything is done on encrypted data. Even if the server is compromised, in the end no sensitive data is leaked.

## Main features

- Ability to compile Python functions (that may use NumPy within) to their FHE equivalents, to operate on encrypted data
- Support for [large collection of operators](https://docs.zama.ai/concrete-numpy/getting-started/compatibility)
- Partial support for floating points
- Support for table lookups on integers
- Support for integration with Client / Server architectures

## Installation

|               OS / HW                | Available on Docker | Available on PyPI |
| :----------------------------------: | :-----------------: | :--------------: |
|                Linux                 |         Yes         |       Yes        |
|               Windows                |         Yes         |   Coming soon    |
|     Windows Subsystem for Linux      |         Yes         |       Yes        |
|            macOS (Intel)             |         Yes         |       Yes        |
| macOS (Apple Silicon, ie M1, M2 etc) |    Yes (Rosetta)    |   Coming soon    |


The preferred way to install Concrete Numpy is through PyPI:

```shell
pip install concrete-numpy
```

You can get the concrete-numpy docker image by  pulling the latest docker image:

```shell
docker pull zamafhe/concrete-numpy:v0.10.0
```

You can find more detailed installation instructions in [installing.md](docs/getting-started/installing.md)

## Getting started

```python
import concrete.numpy as cnp

def add(x, y):
    return x + y

compiler = cnp.Compiler(add, {"x": "encrypted", "y": "encrypted"})
inputset = [(2, 3), (0, 0), (1, 6), (7, 7), (7, 1), (3, 2), (6, 1), (1, 7), (4, 5), (5, 4)]

print(f"Compiling...")
circuit = compiler.compile(inputset)

print(f"Generating keys...")
circuit.keygen()

examples = [(3, 4), (1, 2), (7, 7), (0, 0)]
for example in examples:
    encrypted_example = circuit.encrypt(*example)
    encrypted_result = circuit.run(encrypted_example)
    result = circuit.decrypt(encrypted_result)
    print(f"Evaluation of {' + '.join(map(str, example))} homomorphically = {result}")
```

or if you have a simple function that you can decorate, and you don't care about explicit steps of key generation, encryption, evaluation and decryption:

```python
import concrete.numpy as cnp

@cnp.compiler({"x": "encrypted", "y": "encrypted"})
def add(x, y):
    return x + y

inputset = [(2, 3), (0, 0), (1, 6), (7, 7), (7, 1), (3, 2), (6, 1), (1, 7), (4, 5), (5, 4)]

print(f"Compiling...")
circuit = add.compile(inputset)

examples = [(3, 4), (1, 2), (7, 7), (0, 0)]
for example in examples:
    result = circuit.encrypt_run_decrypt(*example)
    print(f"Evaluation of {' + '.join(map(str, example))} homomorphically = {result}")
```

## Documentation

Full, comprehensive documentation is available at [https://docs.zama.ai/concrete-numpy](https://docs.zama.ai/concrete-numpy).

## Target users

Concrete Numpy is a generic library that supports a variety of use cases. Because of this flexibility,
it doesn't provide primitives for specific use cases.

If you have a specific use case, or a specific field of computation, you may want to build abstractions on top of Concrete Numpy.

One such example is [Concrete ML](https://github.com/zama-ai/concrete-ml), which is built on top of Concrete Numpy to simplify Machine Learning oriented use cases.

## Tutorials

Various tutorials are proposed in the documentation to help you start writing homomorphic programs:

- How to use Concrete Numpy with [Decorators](https://docs.zama.ai/concrete-numpy/tutorials/decorator)
- Partial support of [Floating Points](https://docs.zama.ai/concrete-numpy/tutorials/floating_points)
- How to perform [Table Lookup](https://docs.zama.ai/concrete-numpy/tutorials/table_lookup)

More generally, if you have built awesome projects using Concrete Numpy, feel free to let us know and we'll link to it!

## Need support?

<a target="_blank" href="https://community.zama.ai">
  <img src="https://user-images.githubusercontent.com/5758427/191792238-b132e413-05f9-4fee-bee3-1371f3d81c28.png">
</a>

## License

This software is distributed under the BSD-3-Clause-Clear license. If you have any questions, please contact us at hello@zama.ai.


            

Raw data

            {
    "_id": null,
    "home_page": "https://zama.ai/concrete/",
    "name": "concrete-numpy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<3.11",
    "maintainer_email": "",
    "keywords": "FHE,homomorphic encryption,privacy,security",
    "author": "Zama",
    "author_email": "hello@zama.ai",
    "download_url": "",
    "platform": null,
    "description": "<p align=\"center\">\n<!-- product name logo -->\n  <img width=600 src=\"https://user-images.githubusercontent.com/5758427/193612313-6b1124c7-8e3e-4e23-8b8c-57fd43b17d4f.png\">\n</p>\n\n<p align=\"center\">\n<!-- Version badge using shields.io -->\n  <a href=\"https://github.com/zama-ai/concrete-numpy/releases\">\n    <img src=\"https://img.shields.io/github/v/release/zama-ai/concrete-numpy?style=flat-square\">\n  </a>\n<!-- Link to docs badge using shields.io -->\n  <a href=\"https://docs.zama.ai/concrete-numpy/\">\n    <img src=\"https://img.shields.io/badge/read-documentation-yellow?style=flat-square\">\n  </a>\n<!-- Community forum badge using shields.io -->\n  <a href=\"https://community.zama.ai/c/concrete-numpy\">\n    <img src=\"https://img.shields.io/badge/community%20forum-online-brightgreen?style=flat-square\">\n  </a>\n<!-- Open source badge using shields.io -->\n  <a href=\"https://docs.zama.ai/concrete-numpy/developer/contributing\">\n    <img src=\"https://img.shields.io/badge/we're%20open%20source-contributing.md-blue?style=flat-square\">\n  </a>\n<!-- Follow on twitter badge using shields.io -->\n  <a href=\"https://twitter.com/zama_fhe\">\n    <img src=\"https://img.shields.io/badge/follow-zama_fhe-blue?logo=twitter&style=flat-square\">\n  </a>\n</p>\n\n\n**Concrete Numpy** is an open-source library which simplifies the use of fully homomorphic encryption (FHE) in Python.\n\nFHE is a powerful cryptographic tool, which allows computation to be performed directly on encrypted data without needing to decrypt it first.\n\nWith FHE, you can build services that preserve the privacy of the users. FHE is also great against data breaches as everything is done on encrypted data. Even if the server is compromised, in the end no sensitive data is leaked.\n\n## Main features\n\n- Ability to compile Python functions (that may use NumPy within) to their FHE equivalents, to operate on encrypted data\n- Support for [large collection of operators](https://docs.zama.ai/concrete-numpy/getting-started/compatibility)\n- Partial support for floating points\n- Support for table lookups on integers\n- Support for integration with Client / Server architectures\n\n## Installation\n\n|               OS / HW                | Available on Docker | Available on PyPI |\n| :----------------------------------: | :-----------------: | :--------------: |\n|                Linux                 |         Yes         |       Yes        |\n|               Windows                |         Yes         |   Coming soon    |\n|     Windows Subsystem for Linux      |         Yes         |       Yes        |\n|            macOS (Intel)             |         Yes         |       Yes        |\n| macOS (Apple Silicon, ie M1, M2 etc) |    Yes (Rosetta)    |   Coming soon    |\n\n\nThe preferred way to install Concrete Numpy is through PyPI:\n\n```shell\npip install concrete-numpy\n```\n\nYou can get the concrete-numpy docker image by  pulling the latest docker image:\n\n```shell\ndocker pull zamafhe/concrete-numpy:v0.10.0\n```\n\nYou can find more detailed installation instructions in [installing.md](docs/getting-started/installing.md)\n\n## Getting started\n\n```python\nimport concrete.numpy as cnp\n\ndef add(x, y):\n    return x + y\n\ncompiler = cnp.Compiler(add, {\"x\": \"encrypted\", \"y\": \"encrypted\"})\ninputset = [(2, 3), (0, 0), (1, 6), (7, 7), (7, 1), (3, 2), (6, 1), (1, 7), (4, 5), (5, 4)]\n\nprint(f\"Compiling...\")\ncircuit = compiler.compile(inputset)\n\nprint(f\"Generating keys...\")\ncircuit.keygen()\n\nexamples = [(3, 4), (1, 2), (7, 7), (0, 0)]\nfor example in examples:\n    encrypted_example = circuit.encrypt(*example)\n    encrypted_result = circuit.run(encrypted_example)\n    result = circuit.decrypt(encrypted_result)\n    print(f\"Evaluation of {' + '.join(map(str, example))} homomorphically = {result}\")\n```\n\nor if you have a simple function that you can decorate, and you don't care about explicit steps of key generation, encryption, evaluation and decryption:\n\n```python\nimport concrete.numpy as cnp\n\n@cnp.compiler({\"x\": \"encrypted\", \"y\": \"encrypted\"})\ndef add(x, y):\n    return x + y\n\ninputset = [(2, 3), (0, 0), (1, 6), (7, 7), (7, 1), (3, 2), (6, 1), (1, 7), (4, 5), (5, 4)]\n\nprint(f\"Compiling...\")\ncircuit = add.compile(inputset)\n\nexamples = [(3, 4), (1, 2), (7, 7), (0, 0)]\nfor example in examples:\n    result = circuit.encrypt_run_decrypt(*example)\n    print(f\"Evaluation of {' + '.join(map(str, example))} homomorphically = {result}\")\n```\n\n## Documentation\n\nFull, comprehensive documentation is available at [https://docs.zama.ai/concrete-numpy](https://docs.zama.ai/concrete-numpy).\n\n## Target users\n\nConcrete Numpy is a generic library that supports a variety of use cases. Because of this flexibility,\nit doesn't provide primitives for specific use cases.\n\nIf you have a specific use case, or a specific field of computation, you may want to build abstractions on top of Concrete Numpy.\n\nOne such example is [Concrete ML](https://github.com/zama-ai/concrete-ml), which is built on top of Concrete Numpy to simplify Machine Learning oriented use cases.\n\n## Tutorials\n\nVarious tutorials are proposed in the documentation to help you start writing homomorphic programs:\n\n- How to use Concrete Numpy with [Decorators](https://docs.zama.ai/concrete-numpy/tutorials/decorator)\n- Partial support of [Floating Points](https://docs.zama.ai/concrete-numpy/tutorials/floating_points)\n- How to perform [Table Lookup](https://docs.zama.ai/concrete-numpy/tutorials/table_lookup)\n\nMore generally, if you have built awesome projects using Concrete Numpy, feel free to let us know and we'll link to it!\n\n## Need support?\n\n<a target=\"_blank\" href=\"https://community.zama.ai\">\n  <img src=\"https://user-images.githubusercontent.com/5758427/191792238-b132e413-05f9-4fee-bee3-1371f3d81c28.png\">\n</a>\n\n## License\n\nThis software is distributed under the BSD-3-Clause-Clear license. If you have any questions, please contact us at hello@zama.ai.\n\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "Concrete Numpy is an open-source library which simplifies the use of fully homomorphic encryption (FHE).",
    "version": "0.10.0",
    "split_keywords": [
        "fhe",
        "homomorphic encryption",
        "privacy",
        "security"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d9b43dac308fd619ad985a363e838de32305582c3820b6a4e56971ce079a29b1",
                "md5": "a7612136076421fbd9d3d16e5885ffca",
                "sha256": "1ea3e7025122f3f37e37421e256e84f71fbd1e6165dd6041a2cba9149e8280a0"
            },
            "downloads": -1,
            "filename": "concrete_numpy-0.10.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a7612136076421fbd9d3d16e5885ffca",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<3.11",
            "size": 82891,
            "upload_time": "2023-01-31T09:58:43",
            "upload_time_iso_8601": "2023-01-31T09:58:43.581450Z",
            "url": "https://files.pythonhosted.org/packages/d9/b4/3dac308fd619ad985a363e838de32305582c3820b6a4e56971ce079a29b1/concrete_numpy-0.10.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-31 09:58:43",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "concrete-numpy"
}
        
Elapsed time: 0.03595s