{"id":13799457,"url":"https://github.com/alan-turing-institute/SHEEP","last_synced_at":"2025-05-13T08:31:21.665Z","repository":{"id":77348268,"uuid":"113025590","full_name":"alan-turing-institute/SHEEP","owner":"alan-turing-institute","description":"SHEEP is a Homomorphic Encryption Evaluation Platform","archived":false,"fork":false,"pushed_at":"2023-04-07T17:43:59.000Z","size":7256,"stargazers_count":50,"open_issues_count":24,"forks_count":12,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-11-13T13:48:38.086Z","etag":null,"topics":["homomorphic-encryption","hut23","hut23-172","hut23-205"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alan-turing-institute.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-12-04T09:58:03.000Z","updated_at":"2024-10-23T05:55:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"91782d4d-00ab-426a-a115-c3f79f0635d3","html_url":"https://github.com/alan-turing-institute/SHEEP","commit_stats":{"total_commits":792,"total_committers":11,"mean_commits":72.0,"dds":0.2689393939393939,"last_synced_commit":"7762d834be184db328bbf17ac352f8e9c50dca8d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alan-turing-institute%2FSHEEP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alan-turing-institute%2FSHEEP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alan-turing-institute%2FSHEEP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alan-turing-institute%2FSHEEP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alan-turing-institute","download_url":"https://codeload.github.com/alan-turing-institute/SHEEP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225190583,"owners_count":17435443,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["homomorphic-encryption","hut23","hut23-172","hut23-205"],"created_at":"2024-08-04T00:01:02.934Z","updated_at":"2024-11-18T14:30:33.739Z","avatar_url":"https://github.com/alan-turing-institute.png","language":"C++","funding_links":[],"categories":["Toolkits"],"sub_categories":[],"readme":"# SHEEP is a Homomorphic Encryption Evaluation Platform\n\n## Disclaimer\n\nSHEEP is **development** code.  We strongly recommend that you do not deploy this **prototype** application in a production setting.    SHEEP is intended to be an academic research framework to explore the homomorphic encryption (HE) space, and the characteristics of some HE libraries.  However, we are not responsible for the content of these external libraries, and we offer no guarantees regarding their use.\n\n## Summary\n\nThe overall aim of the SHEEP project is to provide a platform for practitioners to evaluate the state-of-the-art of (fully) homomorphic encryption technology in the context of their concrete application. SHEEP enables this evaluation to be done across libraries implementing different HE schemes (with in some cases incomparable security).\n\n\u003cfigure\u003e\n\u003cimg src=\"https://i.imgur.com/M9KPfZi.png\"/\u003e\n\u003cfigcaption\u003e Components of the SHEEP platform. These include an interpreter for the SHEEP language, an abstraction layer to incorporate HE libraries via their corresponding wrappers, and a reporting component. The user can either provide a program written in the high-level SHEEP language, or run a set of predefined benchmarks. Different aspects of the results can be visualized through a web interface.\u003c/figcaption\u003e\n\u003c/figure\u003e\n\n\n\u003c!-- ![Components of SHEEP. These include an interpreter for the SHEEP language, an abstraction layer to incorporate HE libraries via their corresponding wrappers, and a reporting component. The user can either provide a program written in the high-level SHEEP language, or run a set of predefined benchmarks. Different aspects of the results can be visualized through a web interface.](https://i.imgur.com/M9KPfZi.png) --\u003e\n\n\nTo achieve this goal, the SHEEP platform includes an **library agnostic language** so that computations can be described generically. One can think of it as an *assembly language*.\n\nTo incorporate a library into the platform, all that needs to be done is write a wrapper for it, implementing the operations in the **SHEEP instruction set**. These corresponds to common operations in a HE scheme such as encryption, decryption, homomorphic addition, multiplication, comparison, etc.\n\nBesides allowing the user to execute their own programs via either a web interface or programatically, the library incorporates a set of **native benchmarks**. These are classified in three categories according to their complexity, ranging from low-level microbenchmarks of the basic homomorphic arithmetic operations, to data analysis tasks.\n\nEither on a native benchmark or a user-defined input, the platform evaluates the corresponding program on all the HE libraries that support the instructions of the program. The result is checked for correctness, and metrics such as running time (encryption, decryption, and evaluation) and ciphertext size are reported to a web interface and stored in a database. The web interface also allows convenient plotting of the results for easy visualisation.\n\nThe platform hence enables two main use cases:\n1. It allows users to evaluate a concrete custom computation across libraries (and thus encryption schemes) by simply describing it in a high-level language. This allows to set up a easily reproducible baseline when trying to optimize a given primitive based on HE, e.g. Private Information Retrieval, secure inner product, etc. For example, addition of two numbers in SHEEP looks like this:\n```\nINPUTS a b res\nOUTPUTS res\na b ADD res\n```\n2. The set of predefined benchmarks allows performance snapshots of the state-of-the-art of (fully) homomorphic encryption implementations to be continually produced, as new schemes are invented and their implementations are updated and optimized.\n\nIn summary, the general problem addressed by SHEEP is that of getting a satisfying answer, from the practitioner's point of view, to the following questions:\n\n\u003e \"What is the current state of the implementations of homomorphic encryption?\"\n\n\u003e \"What homomorphic encryption scheme (and implementation) should I use in my application, given some functional and non-functional, e.g. security, latency or bandwidth constraints?\"\n\nIn its current state, the SHEEP platform does not provide a complete solution to these problems, as we believe this requires a community effort. This is why SHEEP's code is open source.\n\n\n## Installation - docker (recommended)\n\nAssuming you have docker installed, from this directory, do:\n```\ndocker-compose build\n```\nThis will build three Docker images: one for the \"server\", one for a web-based frontend, and one for some Jupyter notebooks containing examples\nof SHEEP usage.\n\nTo run the web frontend, do:\n```\ndocker-compose run -p 5000:5000 sheep-frontend\n```\nIf you point your browser to `0.0.0.0:5000` you should get the SHEEP frontend.\n\nTo run the notebooks, do:\n```\ndocker-compose run -p 8888:8888 sheep-notebook\n```\nNow if you paste the URL given in the terminal for \"sheep-notebook_1\"\ninto your browser, but with `localhost` instead of the hex string immediately after the \"http://\", you can access the Jupyter notebook examples.\n\n\n\n## Installation - local\n\nClone this repository onto your local machine.  There are a few packages which the SHEEP platform itself uses, and then there are the HE libraries\nthat we want to evaluate.  Instructions for both follow:\n\n### Core SHEEP dependencies\n\nSHEEP uses the ***cpprestsdk*** library to provide a RESTful API for the sheep server.\nOn OSX, this can be installed with homebrew:\n```\nbrew install cpprestsdk\n```\nFor Linux (Ubuntu 16.04), see the relevant section of ```Dockerfile``` for a working recipe.\n\nFor parallel evaluation of circuits, SHEEP uses Intel's ***tbb*** library.  This can be installed on OSX using homebrew:\n```\nbrew install tbb\n```\nor for apt-based Linux installations:\n```\napt-get -y install libtbb-dev\n```\n\nThere are a few Python packages that are needed for the web front-end and/or the Jupyter notebooks.  Install these with:\n```\npip install  flask\npip install  wtforms\npip install  pytest\npip install  sqlalchemy\npip install  python-nvd3\npip install  requests\npip install  jupyter\npip install  matplotlib\npip install  pandas\n```\n\n\n### Example HE libraries\n\nAfter cloning the SHEEP repo, change to the SHEEP directory then do:\n```\ngit submodule update --init --recursive\n```\nThis will checkout the HElib and TFHE submodules in the lib/ directory.\n\n#### TFHE\n\nTo build TFHE, first install the fftw library (download source from http://www.fftw.org/download.html then follow the instructions on that page)\n\nThen build TFHE as follows:\n```\ncd lib/tfhe\nmkdir build\ncd build\ncmake ../src -DENABLE_TESTS=on -DENABLE_FFTW=on -DCMAKE_BUILD_TYPE=optim -DENABLE_NAYUKI_PORTABLE=off -DENABLE_SPQLIOS_AVX=off -DENABLE_SPQLIOS_FMA=off -DENABLE_NAYUKI_AVX=off\nmake\nsudo make install\n```\n\n#### HElib\n\nHElib depends on the ***GMP*** and ***NTL*** libraries.  To install gmp on OSX do:\n```\nbrew install gmp\n```\n(this will install into ```/usr/local/Cellar/gmp``` - this location is needed when building ntl.)\nFor Linux, gmp can be installed from source - see the relevant section of ```Dockerfile```.\n\nFor ntl, download and follow instructions from [here](http://sid.ethz.ch/debian/ntl/ntl-5.5.2/doc/tour-unix.html).  At the ```./configure``` step, add the argument\n```GMP_PREFIX=/usr/local/Cellar/gmp``` if you installed gmp using homebrew, or the relevant location if you used another method.\n\nThen build HElib as follows:\n```\ncd ../../HElib/src\nmake\nmkdir build\ncd build\ncmake ..\nmake all\n```\n\n#### SEAL\n\nDownload and follow the instructions [here](https://www.microsoft.com/en-us/download/details.aspx?id=56202).\n\n#### libpaillier\n\nDownload the ```tar.gz``` file from [here](http://hms.isi.jhu.edu/acsc/libpaillier/), unpack the archive, cd to the directory, then do\n```\n./configure\nmake\nmake install\n```\nNote that libpaillier depends on gmp - follow the instructions for installing this from the \"HElib\" section if you haven't already.\n\n\n## Building SHEEP\n\nAnd finally build SHEEP:\n```\ncd \u003cbase SHEEP dir\u003e\nmkdir build\ncd build\ncmake ../\nmake all\n```\nThis builds the examples in `build/bin`.\n\nRun the tests with:\n```\nmake test\n```\n\n\n\n## Circuit language and input files\n\nThe inputs to SHEEP are ***circuit*** files, which have the extension `.sheep` and the following format:\n```\nINPUTS \u003ccircuit_input_0\u003e ...\nOUTPUTS \u003ccircuit_output_0\u003e ...\n\u003cgate_input_0\u003e ...  \u003cGATE\u003e \u003cgate_output\u003e\n...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falan-turing-institute%2FSHEEP","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falan-turing-institute%2FSHEEP","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falan-turing-institute%2FSHEEP/lists"}