Package: concrete-numpy
Concrete Numpyis 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 featuresAbility to compile Python functions (that may use NumPy within) to their FHE equivalents, to operate on encrypted dataSupport forlarge collection of operatorsPartial support for floating pointsSupport for table lookups on integersSupport for integration with Client / Server architecturesInstallationOS / HWAvailable on DockerAvailable on PyPILinuxYesYesWindowsYesComing soonWindows Subsystem for LinuxYesYesmacOS (Intel)YesYesmacOS (Apple Silicon, ie M1, M2 etc)Yes (Rosetta)Coming soonThe preferred way to install Concrete Numpy is through PyPI:pipinstallconcrete-numpyYou can get the concrete-numpy docker image by  pulling the latest docker image:dockerpullzamafhe/concrete-numpy:v0.10.0You can find more detailed installation instructions ininstalling.mdGetting startedimportconcrete.numpyascnpdefadd(x,y):returnx+ycompiler=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)]forexampleinexamples: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:importconcrete.numpyascnp@cnp.compiler({"x":"encrypted","y":"encrypted"})defadd(x,y):returnx+yinputset=[(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)]forexampleinexamples:result=circuit.encrypt_run_decrypt(*example)print(f"Evaluation of{' + '.join(map(str,example))}homomorphically ={result}")DocumentationFull, comprehensive documentation is available athttps://docs.zama.ai/concrete-numpy.Target usersConcrete 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 isConcrete ML, which is built on top of Concrete Numpy to simplify Machine Learning oriented use cases.TutorialsVarious tutorials are proposed in the documentation to help you start writing homomorphic programs:How to use Concrete Numpy withDecoratorsPartial support ofFloating PointsHow to performTable LookupMore generally, if you have built awesome projects using Concrete Numpy, feel free to let us know and we'll link to it!Need support?LicenseThis software is distributed under the BSD-3-Clause-Clear license. If you have any questions, please contact us athello@zama.ai.