{"id":32804426,"url":"https://github.com/IntelLabs/hexl","last_synced_at":"2025-11-06T10:02:51.840Z","repository":{"id":37081476,"uuid":"351609713","full_name":"IntelLabs/hexl","owner":"IntelLabs","description":"Intel Homomorphic Encryption Acceleration Library accelerates modular arithmetic operations used in homomorphic encryption by leveraging AVX512 and IFM52 available on Intel's 3rd Generation Xeon Scalable Processors and later","archived":false,"fork":false,"pushed_at":"2025-07-17T23:48:27.000Z","size":2659,"stargazers_count":238,"open_issues_count":0,"forks_count":53,"subscribers_count":14,"default_branch":"development","last_synced_at":"2025-07-18T04:26:41.852Z","etag":null,"topics":["avx-512","cryptography","homomorphic-encryption","privacy"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IntelLabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-03-26T00:01:02.000Z","updated_at":"2025-07-07T12:00:36.000Z","dependencies_parsed_at":"2024-10-26T08:57:07.069Z","dependency_job_id":"4f6bc711-cc13-4480-8aad-4a21e1c3f7c2","html_url":"https://github.com/IntelLabs/hexl","commit_stats":null,"previous_names":["intellabs/hexl"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/IntelLabs/hexl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntelLabs%2Fhexl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntelLabs%2Fhexl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntelLabs%2Fhexl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntelLabs%2Fhexl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IntelLabs","download_url":"https://codeload.github.com/IntelLabs/hexl/tar.gz/refs/heads/development","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntelLabs%2Fhexl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":282986407,"owners_count":26760033,"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","status":"online","status_checked_at":"2025-11-06T02:00:06.180Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["avx-512","cryptography","homomorphic-encryption","privacy"],"created_at":"2025-11-06T10:01:22.290Z","updated_at":"2025-11-06T10:02:51.833Z","avatar_url":"https://github.com/IntelLabs.png","language":"C++","funding_links":[],"categories":["FHE frameworks","C++"],"sub_categories":[],"readme":"[![Build and Test](https://github.com/intel/hexl/actions/workflows/github-ci.yml/badge.svg)](https://github.com/intel/hexl/actions/workflows/github-ci.yml)\n\n# Intel Homomorphic Encryption (HE) Acceleration Library\nIntel:registered: HE Acceleration Library is an open-source library which\nprovides efficient implementations of integer arithmetic on Galois fields. Such\narithmetic is prevalent in cryptography, particularly in homomorphic encryption\n(HE) schemes. Intel HE Acceleration Library targets integer arithmetic with\nword-sized primes, typically 30-60 bits. Intel HE Acceleration Library provides\nan API for 64-bit unsigned integers and targets Intel CPUs. For more details on\nIntel HE Acceleration Library, see our\n[whitepaper](https://arxiv.org/abs/2103.16400.pdf). For tips on best\nperformance, see [Performance](#performance).\n\n## Contents\n- [Intel Homomorphic Encryption (HE) Acceleration Library](#intel-homomorphic-encryption-he-acceleration-library)\n  - [Contents](#contents)\n  - [Introduction](#introduction)\n  - [Building Intel HE Acceleration Library](#building-intel-he-acceleration-library)\n    - [Dependencies](#dependencies)\n    - [Compile-time options](#compile-time-options)\n    - [Compiling Intel HE Acceleration Library](#compiling-intel-he-acceleration-library)\n      - [Linux and Mac](#linux-and-mac)\n      - [Windows](#windows)\n  - [Performance](#performance)\n  - [Testing Intel HE Acceleration Library](#testing-intel-he-acceleration-library)\n  - [Benchmarking Intel HE Acceleration Library](#benchmarking-intel-he-acceleration-library)\n  - [Using Intel HE Acceleration Library](#using-intel-he-acceleration-library)\n  - [Debugging](#debugging)\n  - [Threading](#threading)\n- [Community Adoption](#community-adoption)\n- [Documentation](#documentation)\n- [Contributing](#contributing)\n  - [Repository layout](#repository-layout)\n- [Citing Intel HE Acceleration Library](#citing-intel-he-acceleration-library)\n    - [Version 1.2](#version-12)\n    - [Version 1.1](#version-11)\n    - [Version 1.0](#version-10)\n- [Contributors](#contributors)\n\n## Introduction\nMany cryptographic applications, particularly homomorphic encryption (HE), rely\non integer polynomial arithmetic in a finite field. HE, which enables\ncomputation on encrypted data, typically uses polynomials with degree `N` a\npower of two roughly in the range `N=[2^{10}, 2^{17}]`. The coefficients of\nthese polynomials are in a finite field with a word-sized prime, `q`, up to\n`q`~62 bits. More precisely, the polynomials live in the ring `Z_q[X]/(X^N +\n1)`. That is, when adding or multiplying two polynomials, each coefficient of\nthe result is reduced by the prime modulus `q`. When multiplying two\npolynomials, the resulting polynomials of degree `2N` is additionally reduced\nby taking the remainder when dividing by `X^N+1`.\n\nThe primary bottleneck in many HE applications is polynomial-polynomial\nmultiplication in `Z_q[X]/(X^N + 1)`. For efficient implementation, Intel HE\nAcceleration Library implements the negacyclic number-theoretic transform\n(NTT). To multiply two polynomials, `q_1(x), q_2(x)` using the NTT, we perform\nthe FwdNTT on the two input polynomials, then perform an element-wise modular\nmultiplication, and perform the InvNTT on the result.\n\nIntel HE Acceleration Library implements the following functions:\n- The forward and inverse negacyclic number-theoretic transform (NTT)\n- Element-wise vector-vector modular multiplication\n- Element-wise vector-scalar modular multiplication with optional addition\n- Element-wise modular multiplication\n\nFor each function, the library implements one or several Intel(R) AVX-512\nimplementations, as well as a less performant, more readable native C++\nimplementation. Intel HE Acceleration Library will automatically choose the\nbest implementation for the given CPU Intel(R) AVX-512 feature set. In\nparticular, when the modulus `q` is less than `2^{50}`, the AVX512IFMA\ninstruction set available on Intel IceLake server and IceLake client will\nprovide a more efficient implementation.\n\nFor additional functionality, see the public headers, located in `include/hexl`\n\n## Building Intel HE Acceleration Library\n\nIntel HE Acceleration Library can be built in several ways. Intel HE\nAcceleration Library has been uploaded to the [Microsoft\nvcpkg](https://github.com/microsoft/vcpkg) C++ package manager, which supports\nLinux, macOS, and Windows builds. See the vcpkg repository for instructions to\nbuild Intel HE Acceleration Library with vcpkg, e.g. run `vcpkg install hexl`.\nThere may be some delay in uploading latest release ports to vcpkg. Intel HE\nAcceleration Library provides port files to build the latest version with\nvcpkg. For a static build, run `vcpkg install hexl\n--overlay-ports=/path/to/hexl/port/hexl --head`. For dynamic build, use the\ncustom triplet file and run `vcpkg install hexl:hexl-dynamic-build\n--overlay-ports=/path/to/hexl/port/hexl --head\n--overlay-triplets=/path/to/hexl/port/hexl`. For detailed explanation, see\n[instruction](https://devblogs.microsoft.com/cppblog/registries-bring-your-own-libraries-to-vcpkg/)\nfor building vcpkg port using overlays and use of [custom\ntriplet](https://github.com/microsoft/vcpkg/blob/master/docs/examples/overlay-triplets-linux-dynamic.md#building-dynamic-libraries-on-linux)\nprovided by vcpkg.\n\nIntel HE Acceleration Library also supports a build using the CMake build\nsystem. See below for the instructions to build Intel HE Acceleration Library\nfrom source using CMake.\n\n### Dependencies\nWe have tested Intel HE Acceleration Library on the following operating systems:\n- Ubuntu 20.04\n- macOS 10.15 Catalina\n- Microsoft Windows 10\n\nIntel HE Acceleration Library requires the following dependencies:\n\n| Dependency  | Version                                      |\n|-------------|----------------------------------------------|\n| CMake       | \u003e= 3.13 \\*                                   |\n| Compiler    | gcc \u003e= 7.0, clang++ \u003e= 5.0, MSVC \u003e= 2019     |\n\n\\* For Windows 10, you must check whether the version on CMake you have can\ngenerate the necessary Visual Studio project files. For example, only from\n[CMake 3.14 onwards can MSVC 2019 project files be\ngenerated](https://cmake.org/cmake/help/git-stage/generator/Visual%20Studio%2016%202019.html).\n\n\n### Compile-time options\nIn addition to the standard CMake build options, Intel HE Acceleration Library\nsupports several compile-time flags to configure the build.\nFor convenience, they are listed below:\n\n| CMake option                  | Values   | Default |                                                             |\n| ------------------------------| ---------| --------| ----------------------------------------------------------- |\n| HEXL_BENCHMARK                | ON / OFF | ON      | Set to ON to enable benchmark suite via Google benchmark    |\n| HEXL_COVERAGE                 | ON / OFF | OFF     | Set to ON to enable coverage report of unit-tests           |\n| HEXL_SHARED_LIB               | ON / OFF | OFF     | Set to ON to enable building shared library                 |\n| HEXL_DOCS                     | ON / OFF | OFF     | Set to ON to enable building of documentation               |\n| HEXL_TESTING                  | ON / OFF | ON      | Set to ON to enable building of unit-tests                  |\n| HEXL_TREAT_WARNING_AS_ERROR   | ON / OFF | OFF     | Set to ON to treat all warnings as error                    |\n\n### Compiling Intel HE Acceleration Library\nTo compile Intel HE Acceleration Library from source code, first clone the\nrepository and change directories to where the source has been cloned.\n\n#### Linux and Mac\nThe instructions to build Intel HE Acceleration Library are common to Linux and\nMacOS.\n\nThen, to configure the build, call\n```bash\ncmake -S . -B build\n```\nadding the desired compile-time options with a `-D` flag. For instance,\nto use a non-standard installation directory, configure the build with\n```bash\ncmake -S . -B build -DCMAKE_INSTALL_PREFIX=/path/to/install\n```\n\nOr, to build Intel HE Acceleration Library as a shared library, call\n```bash\ncmake -S . -B build -DHEXL_SHARED_LIB=ON\n```\n\nThen, to build Intel HE Acceleration Library, call\n```bash\ncmake --build build\n```\nThis will build the Intel HE Acceleration Library library in the\n`build/hexl/lib/` directory.\n\nTo install Intel HE Acceleration Library to the installation directory, run\n```bash\ncmake --install build\n```\n\n#### Windows\nTo compile Intel HE Acceleration Library on Windows using Visual Studio in\nRelease mode, configure the build via\n```bash\ncmake -S . -B build -G \"Visual Studio 16 2019\" -DCMAKE_BUILD_TYPE=Release\n```\nadding the desired compile-time options with a `-D` flag (see [Compile-time\noptions](#compile-time-options)). For instance, to use a non-standard\ninstallation directory, configure the build with\n```bash\ncmake -S . -B build -G \"Visual Studio 16 2019\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/path/to/install\n```\n\nTo specify the desired build configuration, pass either `--config Debug` or\n`--config Release` to the build step and install steps. For instance, to build\nIntel HE Acceleration Library in Release mode, call\n```bash\ncmake --build build --config Release\n```\nThis will build the Intel HE Acceleration Library library in the\n`build/hexl/lib/` or `build/hexl/Release/lib` directory.\n\nTo install Intel HE Acceleration Library to the installation directory, run\n```bash\ncmake --build build --target install --config Release\n```\n\n## Performance\nFor best performance, we recommend using Intel HE Acceleration Library on a\nLinux system with the clang++-12 compiler. We also recommend using a processor\nwith Intel AVX512DQ support, with best performance on processors supporting\nIntel AVX512-IFMA52. To determine if your processor supports AVX512-IFMA52,\nsimply look for `-- Setting HEXL_HAS_AVX512IFMA` printed during the configure\nstep.\n\nSee the below table for setting the modulus `q` for best performance.\n| Instruction Set  | Bound on modulus `q` |\n|------------------|----------------------|\n| AVX512-DQ        | `q \u003c 2^30`           |\n| AVX512-IFMA52    | `q \u003c 2^50`           |\n\nSome speedup is still expected for moduli `q \u003e 2^30` using the AVX512-DQ instruction set.\n\n## Testing Intel HE Acceleration Library\nTo run a set of unit tests via\n[Googletest](https://github.com/google/googletest), configure and build Intel\nHE Acceleration Library with `-DHEXL_TESTING=ON` (see [Compile-time\noptions](#compile-time-options)).\nThen, run\n```bash\ncmake --build build --target unittest\n```\nThe unit-test executable itself is located at `build/test/unit-test` on Linux\nand Mac, and at `build\\test\\Release\\unit-test.exe` or\n`build\\test\\Debug\\unit-test.exe` on Windows.\n\n## Benchmarking Intel HE Acceleration Library\nTo run a set of benchmarks via [Google\nbenchmark](https://github.com/google/benchmark), configure and build Intel HE\nAcceleration Library with `-DHEXL_BENCHMARK=ON` (see [Compile-time\noptions](#compile-time-options)).\nThen, run\n```bash\ncmake --build build --target bench\n```\nOn Windows, run\n```bash\ncmake --build build --target bench --config Release\n```\n\nThe benchmark executable itself is located at `build/benchmark/bench_hexl` on\nLinux and Mac, and at `build\\benchmark\\Debug\\bench_hexl.exe` or\n`build\\benchmark\\Release\\bench_hexl.exe` on Windows.\n\n## Using Intel HE Acceleration Library\nThe `example` folder has an example of using Intel HE Acceleration Library in a\nthird-party project.\n\n## Debugging\nFor optimal performance, Intel HE Acceleration Library does not perform input\nvalidation. In many cases the time required for the validation would be longer\nthan the execution of the function itself. To debug Intel HE Acceleration\nLibrary, configure and build Intel HE Acceleration Library with\n`-DCMAKE_BUILD_TYPE=Debug` (see [Compile-time options](#compile-time-options)).\nThis will generate a debug version of the library, e.g. `libhexl_debug.a`, that\ncan be used to debug the execution. In Debug mode, Intel HE Acceleration\nLibrary will also link against [Address\nSanitizer](https://github.com/google/sanitizers/wiki/AddressSanitizer).\n\n**Note**, enabling `CMAKE_BUILD_TYPE=Debug` will result in a significant\nruntime overhead.\n\nTo enable verbose logging for the benchmarks or unit-tests in a Debug build,\nadd the log level as a command-line argument, e.g. `build/benchmark/bench_hexl\n--v=9`. See [easyloggingpp's\ndocumentation](https://github.com/amrayn/easyloggingpp#application-arguments)\nfor more details.\n\n## Threading\nIntel HE Acceleration Library is single-threaded and thread-safe.\n\n# Community Adoption\n\nIntel HE Acceleration Library has been integrated to the following homomorphic\nencryption libraries:\n- [OpenFHE](https://github.com/openfheorg/openfhe-development)\n- [PALISADE](https://gitlab.com/palisade/palisade-release)\n- [Microsoft SEAL](https://github.com/microsoft/SEAL)\n- [HElib](https://github.com/homenc/HElib)\n\nSee also the [Intel Homomorphic Encryption\nToolkit](https://github.com/intel/he-toolkit) for example uses cases using\nIntel HE Acceleration Library.\n\nPlease let us know if you are aware of any other uses of Intel HE Acceleration\nLibrary.\n\n# Documentation\nIntel HE Acceleration Library supports documentation via Doxygen. See\n[https://intel.github.io/hexl](https://intel.github.io/hexl) for the latest\nDoxygen documentation.\n\nTo build documentation, first install `doxygen` and `graphviz`, e.g.\n```bash\nsudo apt-get install doxygen graphviz\n```\nThen, configure Intel HE Acceleration Library with `-DHEXL_DOCS=ON` (see\n[Compile-time options](#compile-time-options)).\n To build Doxygen documentation, after configuring Intel HE Acceleration\n Library with `-DHEXL_DOCS=ON`, run\n```\ncmake --build build --target docs\n```\nTo view the generated Doxygen documentation, open the generated\n`docs/doxygen/html/index.html` file in a web browser.\n\n# Contributing\nIntel HE Acceleration Library welcomes external contributions.\nTo know more about contributing please go to [CONTRIBUTING.md](CONTRIBUTING.md).\n\nWe encourage feedback and suggestions via [Github\nIssues](https://github.com/intel/hexl/issues) as well as discussion via [Github\nDiscussions](https://github.com/intel/hexl/discussions).\n\n## Repository layout\nPublic headers reside in the `hexl/include` folder.\nPrivate headers, e.g. those containing Intel(R) AVX-512 code should not be put\nin this folder.\n\n# Citing Intel HE Acceleration Library\nTo cite Intel HE Acceleration Library, please use the following BibTeX entry.\n\n### Version 1.2\n```tex\n    @misc{IntelHEXL,\n        author={Boemer, Fabian and Kim, Sejun and Seifu, Gelila and de Souza, Fillipe DM and Gopal, Vinodh and others},\n        title = {{I}ntel {HEXL} (release 1.2)},\n        howpublished = {\\url{https://github.com/intel/hexl}},\n        month = september,\n        year = 2021,\n        key = {Intel HEXL}\n    }\n```\n\n### Version 1.1\n```tex\n    @misc{IntelHEXL,\n        author={Boemer, Fabian and Kim, Sejun and Seifu, Gelila and de Souza, Fillipe DM and Gopal, Vinodh and others},\n        title = {{I}ntel {HEXL} (release 1.1)},\n        howpublished = {\\url{https://github.com/intel/hexl}},\n        month = may,\n        year = 2021,\n        key = {Intel HEXL}\n    }\n```\n\n### Version 1.0\n```tex\n    @misc{IntelHEXL,\n        author={Boemer, Fabian and Kim, Sejun and Seifu, Gelila and de Souza, Fillipe DM and Gopal, Vinodh and others},\n        title = {{I}ntel {HEXL} (release 1.0)},\n        howpublished = {\\url{https://github.com/intel/hexl}},\n        month = april,\n        year = 2021,\n        key = {Intel HEXL}\n    }\n```\n\n# Contributors\nThe Intel contributors to this project, sorted by last name, are\n  - [Paky Abu-Alam](https://www.linkedin.com/in/paky-abu-alam-89797710/)\n  - [Flavio Bergamaschi](https://www.linkedin.com/in/flavio-bergamaschi-1634141/)\n  - [Fabian Boemer](https://www.linkedin.com/in/fabian-boemer-5a40a9102/)\n  - [Jeremy Bottleson](https://www.linkedin.com/in/jeremy-bottleson-38852a7/)\n  - [Jack Crawford](https://www.linkedin.com/in/jacklhcrawford/)\n  - [Fillipe D.M. de Souza](https://www.linkedin.com/in/fillipe-d-m-de-souza-a8281820/)\n  - [Hamish Hunt](https://www.linkedin.com/in/hamish-hunt/)\n  - [Sergey Ivanov](https://www.linkedin.com/in/sergey-ivanov-451b72195/)\n  - [Akshaya Jagannadharao](https://www.linkedin.com/in/akshaya-jagannadharao/)\n  - [Jingyi Jin](https://www.linkedin.com/in/jingyi-jin-655735/)\n  - [Sejun Kim](https://www.linkedin.com/in/sejun-kim-2b1b4866/)\n  - [Nir Peled](https://www.linkedin.com/in/nir-peled-4a52266/)\n  - [Kylan Race](https://www.linkedin.com/in/kylanrace/)\n  - [Jose Rojas](https://www.linkedin.com/in/joserochh/) (lead)\n  - [Gelila Seifu](https://www.linkedin.com/in/gelila-seifu/)\n\nIn addition to the Intel contributors listed, we are also grateful to\ncontributions to this project that are not reflected in the Git history:\n  - [Antonis Papadimitriou](https://www.linkedin.com/in/apapadimitriou/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIntelLabs%2Fhexl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FIntelLabs%2Fhexl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIntelLabs%2Fhexl/lists"}