{ "info": { "author": "The TF Encrypted Authors", "author_email": "contact@tf-encrypted.io", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering :: Artificial Intelligence", "Topic :: Security :: Cryptography" ], "description": "# TF Seal\n\nTF Seal provides a bridge between [TF Encrypted](https://github.com/tf-encrypted/tf-encrypted) and the [Microsoft SEAL](https://github.com/microsoft/SEAL) homomorphic encryption library, making it easier than ever to use this library to compute on encrypted data directly from TensorFlow.\n\n[![PyPI](https://img.shields.io/pypi/v/tf-seal.svg)](https://pypi.org/project/tf-seal/) [![CircleCI Badge](https://circleci.com/gh/tf-encrypted/tf-seal/tree/master.svg?style=svg)](https://circleci.com/gh/tf-encrypted/tf-seal/tree/master)\n\n## Usage\n\nThe following demonstrates how to perform a matrix multiplication using homomorphic encryption inside of TensorFlow.\n\n```\nimport numpy as np\nimport tensorflow as tf\n\nimport tf_seal as tfs\n\npublic_keys, secret_key = tfs.seal_key_gen(gen_relin=True, gen_galois=True)\n\n# encrypted input -> tf_seal.Tensor\na_plain = np.random.normal(size=(2, 2)).astype(np.float32)\na = tfs.constant(a_plain, secret_key, public_keys)\n\n# public weights\nb = np.random.normal(size=(2, 2)).astype(np.float32)\n\n# because of how the data is laid out in memory tfs.matmul expects\n# the b matrix to be order column-major wise\nc = tfs.matmul(a, b.transpose())\n\nwith tf.Session() as sess:\n print(sess.run(c))\n```\n\n## Installation\n\nWe recommend using [Miniconda](https://docs.conda.io/en/latest/miniconda.html) or [Anaconda](https://www.anaconda.com/distribution/) to set up and use a Python 3.7 environment for all instructions below:\n\n```\nconda create -n tfseal python=3.7 -y\nsource activate tfseal\n```\n\n### Custom TensorFlow\n\nA custom build of TensorFlow is currently needed to run TF Seal due to a mismatch between the C++ version used by the official TensorFlow build (C++11) and the one needed by Microsoft SEAL (C++17). A [patched version of TensorFlow](https://github.com/dropoutlabs/tensorflow) built with C++17 can be installed as shown below.\n\n#### Ubuntu\n\n```\nwget https://storage.googleapis.com/tf-pips/tf-c++17-support/tf_nightly-1.14.0-cp37-cp37m-linux_x86_64.whl\npip install tf_nightly-1.14.0-cp37-cp37m-linux_x86_64.whl\n```\n\n#### macOS\n\n```\nwget https://storage.googleapis.com/tf-pips/tf-c++17-support/tf_nightly-1.14.0-cp37-cp37m-macosx_10_7_x86_64.whl\npip install tf_nightly-1.14.0-cp37-cp37m-macosx_10_7_x86_64.whl\n```\n\nAfter installing the custom build of TensorFlow you can install TF Seal from [PyPi]() using pip:\n\n```\npip install tf-seal\n```\n\n## Examples\n\nThere is currently one example displaying how we can run a simple logistic regression prediction with TF SEAL.\n\nOnce TF SEAL is installed we can run the example by simplying running:\n\n```\npython logistic_regression.py\n```\n\n## Development\n\nWe recommend using [Miniconda](https://docs.conda.io/en/latest/miniconda.html) or [Anaconda](https://www.anaconda.com/distribution/) to set up and use a Python 3.7 environment for all instructions below:\n\n```\nconda create -n tfseal-dev python=3.7 -y\nsource activate tfseal-dev\n```\n\n### Requirements\n\n#### Ubuntu\n\n- Python (== 3.7)\n- [Bazel](https://www.bazel.build/) (>= 0.26.1)\n- CMake\n- [TensorFlow built with C++17](#custom-tensorflow)\n\nCMake can be installed simply with apt:\n\n```\nsudo apt install cmake\n```\n\nBazel is a little more involved, the following instructions can be installed, recommend installing Bazel 0.26.1: https://docs.bazel.build/versions/master/install-ubuntu.html#install-with-installer-ubuntu\n\nThe remaining PyPI packages can then be installed using:\n\n```\npip install -r requirements-dev.txt\n```\n\nOnce the custom TensorFlow is installed you will be able to start development.\n\n#### macOS\n\nWe need the following items:\n\n- Python (== 3.7)\n- [Bazel](https://www.bazel.build/) (>= 0.26.1)\n- CMake\n- [TensorFlow built with C++17](#custom-tensorflow)\n\nUsing [Homebrew](https://brew.sh/) we make sure that both [Bazel](https://docs.bazel.build/versions/master/install-os-x.html#install-with-installer-mac-os-x) and CMake are installed:\n\n```\nbrew tap bazelbuild/tap\nbrew install bazelbuild/tap/bazel\nbrew install cmake\n```\n\nThe remaining PyPI packages can then be installed using:\n\n```\npip install -r requirements-dev.txt\n```\n\nOnce the custom TensorFlow is installed you will be able to start development.\n\n### Testing\n\nOnce the development environment is set up you can run:\n\n```\nmake test\n```\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/tf-encrypted/tf-seal", "keywords": "", "license": "Apache License 2.0", "maintainer": "", "maintainer_email": "", "name": "tf-seal", "package_url": "https://pypi.org/project/tf-seal/", "platform": "", "project_url": "https://pypi.org/project/tf-seal/", "project_urls": { "Homepage": "https://github.com/tf-encrypted/tf-seal" }, "release_url": "https://pypi.org/project/tf-seal/0.1.0/", "requires_dist": [ "numpy (>=1.14)", "tf-nightly (<2,>=1.14.0)", "tf-nightly (<2,>=1.14.0) ; extra == 'tf'" ], "requires_python": "==3.7.*", "summary": "Bridge between TensorFlow and the Microsoft SEAL homomorphic encryption library.", "version": "0.1.0" }, "last_serial": 5645179, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "e1c51f6246d0df08c592adb7d301b963", "sha256": "75fa589075015eb401c2c0bfe3d75aec81b117063d204abd5f1c29f3ca616f1a" }, "downloads": -1, "filename": "tf_seal-0.1.0-cp37-cp37m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "e1c51f6246d0df08c592adb7d301b963", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": "==3.7.*", "size": 324763, "upload_time": "2019-08-07T13:55:40", "url": "https://files.pythonhosted.org/packages/eb/b7/ecfaa0325f0da16347258b3f49cf2000093f1c63fad7cc0b94689b190440/tf_seal-0.1.0-cp37-cp37m-manylinux1_x86_64.whl" } ], "0.1.0rc1": [ { "comment_text": "", "digests": { "md5": "2f7da0cf9581c056e39443554ba97d8b", "sha256": "608181aa5d7526643716a24504cbb5f20443ea6b5def605f999064a35c95f54f" }, "downloads": -1, "filename": "tf_seal-0.1.0rc1-cp37-cp37m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "2f7da0cf9581c056e39443554ba97d8b", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": "==3.7", "size": 324827, "upload_time": "2019-08-07T07:45:03", "url": "https://files.pythonhosted.org/packages/54/21/ed92de146bc8a2a059461716e5ef38c05fa9ee428e2e4c3c99e80ccdbb73/tf_seal-0.1.0rc1-cp37-cp37m-manylinux1_x86_64.whl" } ], "0.1.0rc3": [ { "comment_text": "", "digests": { "md5": "4eb9d542459d5d5124dd4607508d1d1d", "sha256": "13c555da8a5b336d6ec85f8ce91f9590abdf52c4607aefabf292be7e8f3fe56b" }, "downloads": -1, "filename": "tf_seal-0.1.0rc3-cp37-cp37m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "4eb9d542459d5d5124dd4607508d1d1d", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": "==3.7", "size": 324828, "upload_time": "2019-08-07T12:43:38", "url": "https://files.pythonhosted.org/packages/54/00/0f321c1a52853767c4e416ffd0d5e7c7ebebe84a2daf064b96d67e27e5a4/tf_seal-0.1.0rc3-cp37-cp37m-manylinux1_x86_64.whl" } ], "0.1.0rc4": [ { "comment_text": "", "digests": { "md5": "4f6f34ee7220676721dda3488f4f2d4f", "sha256": "30e56daeb5997f889861603319ee1abbb5c72c26e128785f20c1704705091dc9" }, "downloads": -1, "filename": "tf_seal-0.1.0rc4-cp37-cp37m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "4f6f34ee7220676721dda3488f4f2d4f", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": "==3.7.*", "size": 324828, "upload_time": "2019-08-07T13:31:21", "url": "https://files.pythonhosted.org/packages/27/96/aecca0d79e8f569bd449a3217bc6f4947a1d4fbaa97cced825b9580f9beb/tf_seal-0.1.0rc4-cp37-cp37m-manylinux1_x86_64.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e1c51f6246d0df08c592adb7d301b963", "sha256": "75fa589075015eb401c2c0bfe3d75aec81b117063d204abd5f1c29f3ca616f1a" }, "downloads": -1, "filename": "tf_seal-0.1.0-cp37-cp37m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "e1c51f6246d0df08c592adb7d301b963", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": "==3.7.*", "size": 324763, "upload_time": "2019-08-07T13:55:40", "url": "https://files.pythonhosted.org/packages/eb/b7/ecfaa0325f0da16347258b3f49cf2000093f1c63fad7cc0b94689b190440/tf_seal-0.1.0-cp37-cp37m-manylinux1_x86_64.whl" } ] }