Intel:registered: Homomorphic Encryption Acceleration Library accelerates modular arithmetic operations used in homomorphic encryption

Overview

Intel Homomorphic Encryption Acceleration Library (HEXL)

Intel ®️ HEXL is an open-source library which provides efficient implementations of integer arithmetic on Galois fields. Such arithmetic is prevalent in cryptography, particularly in homomorphic encryption (HE) schemes. Intel HEXL targets integer arithmetic with word-sized primes, typically 40-60 bits. Intel HEXL provides an API for 64-bit unsigned integers and targets Intel CPUs.

Contents

Introduction

Many cryptographic applications, particularly homomorphic encryption (HE), rely on integer polynomial arithmetic in a finite field. HE, which enables computation on encrypted data, typically uses polynomials with degree N a power of two roughly in the range N=[2^{10}, 2^{17}]. The coefficients of these polynomials are in a finite field with a word-sized primes, p, up to p~62 bits. More precisely, the polynomials live in the ring Z_p[X]/(X^N + 1). That is, when adding or multiplying two polynomials, each coefficient of the result is reduced by the prime modulus p. When multiplying two polynomials, the resulting polynomials of degree 2N is additionally reduced by taking the remainder when dividing by X^N+1.

The primary bottleneck in many HE applications is polynomial-polynomial multiplication in Z_p[X]/(X^N + 1). For efficient implementation, Intel HEXL implements the negacyclic number-theoretic transform (NTT). To multiply two polynomials, p_1(x), p_2(x) using the NTT, we perform the FwdNTT on the two input polynomials, then perform an element-wise modular multiplication, and perform the InvNTT on the result.

Intel HEXL implements the following functions:

  • The forward and inverse negacyclic number-theoretic transform (NTT)
  • Element-wise vector-vector modular multiplication
  • Element-wise vector-scalar modular multiplication with optional addition
  • Element-wise modular multiplication

For each function, the library implements one or several Intel(R) AVX-512 implementations, as well as a less performant, more readable native C++ implementation. Intel HEXL will automatically choose the best implementation for the given CPU Intel(R) AVX-512 feature set. In particular, when the modulus p is less than 2^{50}, the AVX512IFMA instruction set available on Intel IceLake server and IceLake client will provide a more efficient implementation.

For additional functionality, see the public headers, located in include/hexl

Building Intel HEXL

Dependencies

We have tested Intel HEXL on the following operating systems:

  • Ubuntu 18.04
  • macOS 10.15
  • Microsoft Windows 10

Intel HEXL requires the following dependencies:

Dependency Version
CMake >= 3.5.1
Compiler gcc >= 7.0, clang++ >= 5.0, MSVC >= 2019

For best performance, we recommend using a processor with AVX512-IFMA52 support, and a recent compiler (gcc >= 8.0, clang++ >= 6.0). To determine if your process supports AVX512-IFMA52, simply look for HEXL_HAS_AVX512IFMA during the configure step (see Compiling Intel HEXL).

Compile-time options

In addition to the standard CMake build options, Intel HEXL supports several compile-time flags to configure the build. For convenience, they are listed below:

CMake option Values
HEXL_BENCHMARK ON / OFF (default ON) Set to ON to enable benchmark suite via Google benchmark
HEXL_COVERAGE ON / OFF (default OFF) Set to ON to enable coverage report of unit-tests
HEXL_DEBUG ON / OFF (default OFF) Set to ON to enable debugging at large runtime penalty
HEXL_DOCS ON / OFF (default OFF) Set to ON to enable building of documentation
HEXL_ENABLE_ADDRESS_SANITIZER ON / OFF (default OFF) Set to ON to enable building with address sanitizer (ASan)
HEXL_ENABLE_THREAD_SANITIZER ON / OFF (default OFF) Set to ON to enable building with thread sanitizer (TSan)
HEXL_ENABLE_UB_SANITIZER ON / OFF (default OFF) Set to ON to enable building with undefined behavior sanitizer (UBSan)
HEXL_EXPORT ON / OFF (default OFF) Set to ON to enable export of Intel HEXL for use in 3rd-party project
HEXL_SHARED_LIB ON / OFF (default OFF) Set to ON to enable building shared library
HEXL_TESTING ON / OFF (default ON) Set to ON to enable building of unit-tests

Compiling Intel HEXL

The instructions to build Intel HEXL are common between Linux, MacOS, and Windows.

To compile Intel HEXL from source code, first clone the repository into your current directory. Then, to configure the build, call

cmake -S . -B build

adding the desired compile-time options with a -D flag. For instance, to build Intel HEXL with debugging capabilities, call

cmake -S . -B build -DHEXL_DEBUG=ON

Then, to build Intel HEXL, call

cmake --build build

This will build the Intel HEXL library in the build/hexl/lib/ directory.

To install Intel HEXL to the installation directory, run

cmake --install build

To use a non-standard installation directory, configure the build with

cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/path/to/install

Testing Intel HEXL

To run a set of unit tests via Googletest, configure and build Intel HEXL with -DHEXL_TESTING=ON (see Compile-time options). Then, run

cmake --build build --target unittest

The unit-test executable itself is located at build/test/unit-test

Benchmarking Intel HEXL

To run a set of benchmarks via Google benchmark, configure and build Intel HEXL with -DHEXL_BENCHMARK=ON (see Compile-time options). Then, run

cmake --build build --target bench

The benchmark executable itself is located at build/benchmark/bench_hexl

Using Intel HEXL

The example folder has an example of using Intel HEXL in a third-party project.

Debugging

For optimal performance, Intel HEXL does not perform input validation. In many cases the time required for the validation would be longer than the execution of the function itself. To debug Intel HEXL, configure and build Intel HEXL with -DHEXL_DEBUG=ON (see Compile-time options). This will generate a debug version of the library, e.g. libhexl_debug.a, that can be used to debug the execution.

Note, enabling HEXL_DEBUG=ON will result in a significant runtime overhead.

Threading

Intel HEXL is single-threaded and thread-safe.

Documentation

See https://intel.github.io/hexl for Doxygen documentation.

Intel HEXL supports documentation via Doxygen and sphinx. To build documentation, first install doxygen and graphviz, e.g.

sudo apt-get install doxygen graphviz

Then, configure Intel HEXL with -DHEXL_DOCS=ON (see Compile-time options).

Doxygen

To build Doxygen documentation, after configuring Intel HEXL with -DHEXL_DOCS=ON, run

cmake --build build --target doxygen

To view the generated Doxygen documentation, open the generated build/docs/doxygen/html/index.html file in a web browser.

Sphinx

To build the sphinx documentation, install sphinx and required dependencies breathe, m2r2, e.g.

sudo apt-get install python3-sphinx
pip3 install breathe m2r2

Then, after configuring Intel HEXL with -DHEXL_DOCS=ON, run

cmake --build build --target docs

To view the generated Sphinx documentation, open the generated build/docs/sphinx/html/index.html file in a web browser.

Contributing

At this time, Intel HEXL does not accept external contributions. We encourage feedback and suggestions via issues.

For Intel developers, use pre-commit to validate the formatting of the code.

Before contributing, please run

cmake --build build --target check unittest

and make sure pre-commit checks and all unit tests pass.

Repository layout

Public headers reside in the hexl/include folder. Private headers, e.g. those containing Intel(R) AVX-512 code should not be put in this folder.

Issues
  • How does hexl performs against NFLLib?

    How does hexl performs against NFLLib?

    I was wondering if your benchmarks could be tweaked a little to show the performance against NFLLib. It seems like NFLLib is more popular and the results would give some clarifications on which one to choose.

    opened by rogpld 13
  • Add a port file to vcpkg?

    Add a port file to vcpkg?

    FYI, you can create a port file in vcpkg so that we can add a feature to SEAL:

    ./vcpkg install seal       # installs SEAL without HEXL
    ./vcpkg install seal[hexl] # installs SEAL with HEXL
    
    opened by WeiDaiWD 8
  • EltwiseReduceMod fails on EltwiseReduceModAVX512 operation with a modulus that is between 51 and 52 bits.

    EltwiseReduceMod fails on EltwiseReduceModAVX512 operation with a modulus that is between 51 and 52 bits.

    The library does not reduce properly for any modulus between 51 and 52 bits. See this test:

    TEST(ReduceFailure, ReduceFailure) { std::vector<uint64_t> tst = { 41834706795195925, 4670328046076965, 17760383643480343, 49435670237278413, 24379914680392825, 33362919182756282, 14501318335168678, 31183658415687847 }; auto mod = 4440955546175441; auto chk = tst; intel::hexl::EltwiseReduceMod(chk.data(), tst.data(), tst.size(), mod, mod, 1); auto exp = tst; for (auto & elem : exp) { elem %= mod; } ASSERT_EQ(exp, chk); }

    This is just an example. I have tried several different moduli of the same bit width and several different inputs. The reduction function does not match the modulus operation.

    opened by jcalafato1 5
  • HEXL slowing down some operations in Microsoft SEAL benchmarks

    HEXL slowing down some operations in Microsoft SEAL benchmarks

    Hello HEXL team,

    We are looking into enabling HEXL for Microsoft SEAL. To estimate whether we would see a performance increase I launched an AWS c5.large instance (running Amazon Linux 2). It has avx512dq but not IFMA, so the HEXL paper led me to expect some performance improvements. Here's the lscpu output:

    $ sudo lscpu
    Architecture:        x86_64
    CPU op-mode(s):      32-bit, 64-bit
    Byte Order:          Little Endian
    CPU(s):              2
    On-line CPU(s) list: 0,1
    Thread(s) per core:  2
    Core(s) per socket:  1
    Socket(s):           1
    NUMA node(s):        1
    Vendor ID:           GenuineIntel
    CPU family:          6
    Model:               85
    Model name:          Intel(R) Xeon(R) Platinum 8124M CPU @ 3.00GHz
    Stepping:            4
    CPU MHz:             3400.103
    BogoMIPS:            6000.00
    Hypervisor vendor:   KVM
    Virtualization type: full
    L1d cache:           32K
    L1i cache:           32K
    L2 cache:            1024K
    L3 cache:            25344K
    NUMA node0 CPU(s):   0,1
    Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves ida arat pku ospke
    

    I downloaded SEAL and built its current main branch (commit 97e4b8d). First I built without HEXL and ran SEAL's built in performance tests for BFV (i.e. running ./build/bin/sealexamples and choosing option 7, then 1), getting the following results as a baseline:

    +--------------------------------------------------------------------------+
    |         BFV Performance Test with Degrees: 4096, 8192, and 16384         |
    +--------------------------------------------------------------------------+
    /
    | Encryption parameters :
    |   scheme: BFV
    |   poly_modulus_degree: 4096
    |   coeff_modulus size: 109 (36 + 36 + 37) bits
    |   plain_modulus: 786433
    \
    
    Generating secret/public keys: Done
    Generating relinearization keys: Done [2181 microseconds]
    Generating Galois keys: Done [44914 microseconds]
    Running tests .......... Done
    
    Average batch: 93 microseconds
    Average unbatch: 81 microseconds
    Average encrypt: 1509 microseconds
    Average decrypt: 413 microseconds
    Average add: 14 microseconds
    Average multiply: 4052 microseconds
    Average multiply plain: 615 microseconds
    Average square: 2902 microseconds
    Average relinearize: 845 microseconds
    Average rotate rows one step: 861 microseconds
    Average rotate rows random: 2911 microseconds
    Average rotate columns: 858 microseconds
    Average serialize ciphertext: 13 microseconds
    Average compressed (ZLIB) serialize ciphertext: 11545 microseconds
    Average compressed (Zstandard) serialize ciphertext: 1642 microseconds
    
    /
    | Encryption parameters :
    |   scheme: BFV
    |   poly_modulus_degree: 8192
    |   coeff_modulus size: 218 (43 + 43 + 44 + 44 + 44) bits
    |   plain_modulus: 786433
    \
    
    Generating secret/public keys: Done
    Generating relinearization keys: Done [12411 microseconds]
    Generating Galois keys: Done [287076 microseconds]
    Running tests .......... Done
    
    Average batch: 147 microseconds
    Average unbatch: 163 microseconds
    Average encrypt: 4271 microseconds
    Average decrypt: 1472 microseconds
    Average add: 63 microseconds
    Average multiply: 15933 microseconds
    Average multiply plain: 2569 microseconds
    Average square: 11515 microseconds
    Average relinearize: 4309 microseconds
    Average rotate rows one step: 4367 microseconds
    Average rotate rows random: 16938 microseconds
    Average rotate columns: 4332 microseconds
    Average serialize ciphertext: 37 microseconds
    Average compressed (ZLIB) serialize ciphertext: 42170 microseconds
    Average compressed (Zstandard) serialize ciphertext: 1738 microseconds
    
    /
    | Encryption parameters :
    |   scheme: BFV
    |   poly_modulus_degree: 16384
    |   coeff_modulus size: 438 (48 + 48 + 48 + 49 + 49 + 49 + 49 + 49 + 49) bits
    |   plain_modulus: 786433
    \
    
    Generating secret/public keys: Done
    Generating relinearization keys: Done [83935 microseconds]
    Generating Galois keys: Done [2136795 microseconds]
    Running tests .......... Done
    
    Average batch: 274 microseconds
    Average unbatch: 346 microseconds
    Average encrypt: 14563 microseconds
    Average decrypt: 6018 microseconds
    Average add: 295 microseconds
    Average multiply: 67476 microseconds
    Average multiply plain: 10846 microseconds
    Average square: 50479 microseconds
    Average relinearize: 26285 microseconds
    Average rotate rows one step: 26960 microseconds
    Average rotate rows random: 127576 microseconds
    Average rotate columns: 27025 microseconds
    Average serialize ciphertext: 319 microseconds
    Average compressed (ZLIB) serialize ciphertext: 181093 microseconds
    Average compressed (Zstandard) serialize ciphertext: 6015 microseconds
    

    Then I recompiled with -DSEAL_USE_INTEL_HEXL=ON and repeated the process and got the following:

    +--------------------------------------------------------------------------+
    |         BFV Performance Test with Degrees: 4096, 8192, and 16384         |
    +--------------------------------------------------------------------------+
    /
    | Encryption parameters :
    |   scheme: BFV
    |   poly_modulus_degree: 4096
    |   coeff_modulus size: 109 (36 + 36 + 37) bits
    |   plain_modulus: 786433
    \
    
    Generating secret/public keys: Done
    Generating relinearization keys: Done [2114 microseconds]
    Generating Galois keys: Done [42659 microseconds]
    Running tests .......... Done
    
    Average batch: 222 microseconds
    Average unbatch: 42 microseconds
    Average encrypt: 1183 microseconds
    Average decrypt: 902 microseconds
    Average add: 5 microseconds
    Average multiply: 3669 microseconds
    Average multiply plain: 581 microseconds
    Average square: 2765 microseconds
    Average relinearize: 738 microseconds
    Average rotate rows one step: 560 microseconds
    Average rotate rows random: 2216 microseconds
    Average rotate columns: 556 microseconds
    Average serialize ciphertext: 15 microseconds
    Average compressed (ZLIB) serialize ciphertext: 11515 microseconds
    Average compressed (Zstandard) serialize ciphertext: 1683 microseconds
    
    /
    | Encryption parameters :
    |   scheme: BFV
    |   poly_modulus_degree: 8192
    |   coeff_modulus size: 218 (43 + 43 + 44 + 44 + 44) bits
    |   plain_modulus: 786433
    \
    
    Generating secret/public keys: Done
    Generating relinearization keys: Done [10650 microseconds]
    Generating Galois keys: Done [238692 microseconds]
    Running tests .......... Done
    
    Average batch: 310 microseconds
    Average unbatch: 69 microseconds
    Average encrypt: 3035 microseconds
    Average decrypt: 3722 microseconds
    Average add: 23 microseconds
    Average multiply: 13892 microseconds
    Average multiply plain: 2535 microseconds
    Average square: 10526 microseconds
    Average relinearize: 3145 microseconds
    Average rotate rows one step: 2781 microseconds
    Average rotate rows random: 11008 microseconds
    Average rotate columns: 2742 microseconds
    Average serialize ciphertext: 38 microseconds
    Average compressed (ZLIB) serialize ciphertext: 42019 microseconds
    Average compressed (Zstandard) serialize ciphertext: 1928 microseconds
    
    /
    | Encryption parameters :
    |   scheme: BFV
    |   poly_modulus_degree: 16384
    |   coeff_modulus size: 438 (48 + 48 + 48 + 49 + 49 + 49 + 49 + 49 + 49) bits
    |   plain_modulus: 786433
    \
    
    Generating secret/public keys: Done
    Generating relinearization keys: Done [68194 microseconds]
    Generating Galois keys: Done [1699540 microseconds]
    Running tests .......... Done
    
    Average batch: 578 microseconds
    Average unbatch: 145 microseconds
    Average encrypt: 9196 microseconds
    Average decrypt: 15750 microseconds
    Average add: 168 microseconds
    Average multiply: 60583 microseconds
    Average multiply plain: 10694 microseconds
    Average square: 47020 microseconds
    Average relinearize: 17176 microseconds
    Average rotate rows one step: 16948 microseconds
    Average rotate rows random: 80074 microseconds
    Average rotate columns: 16925 microseconds
    Average serialize ciphertext: 307 microseconds
    Average compressed (ZLIB) serialize ciphertext: 181309 microseconds
    Average compressed (Zstandard) serialize ciphertext: 5996 microseconds
    

    We do see noticeable performance gains for most operations, but batching and decryption are taking >100% more time. Is there any guidance you can offer on why this might be the case, and if there's anything we can do to address it?

    Thanks.

    opened by jryancarr 4
  • Fboemer/seal ckks ops

    Fboemer/seal ckks ops

    Adds SEAL CKKS multiply and SEAL CKKS key switch ops, enabled via a HEXL_EXPERIMENTAL compile-time flag.

    See https://jiratest.idoc.intel.com/browse/GLADE-22

    opened by fboemer 3
  • CKKS multiply experimental feature doesn't work correctly when integrated with SEAL

    CKKS multiply experimental feature doesn't work correctly when integrated with SEAL

    When trying to integrate the HEXL experimental features into SEAL, I found that it's not giving me the correct results. I'm not sure if I'm doing something wrong or if there is an error in the CKKS multiply implementation of HEXL.

    How to reproduce:

    git clone https://github.com/tgonzalez89-intel/SEAL.git
    git checkout hexl-ckks-mult-bug
    ./build.sh
    cd build/bin
    ./sealtest
    

    Observe that the tests fail.

    You can run git diff 3.7.2 to observe the changes I made to SEAL in order to integrate HEXL's CKKS multiply.

    opened by tgonzalez89-intel 2
  • Fix build failure due to specifying wrong branch name for gbenchmark

    Fix build failure due to specifying wrong branch name for gbenchmark

    This PR fixes the build failure when enabling benchmarking (by default). Its branch name seems to have changed recently https://github.com/google/benchmark/issues/1116.

    $ cmake -S . -B build
    -- CMAKE_BUILD_TYPE:              Release
    -- CMAKE_C_COMPILER:              /usr/bin/cc
    -- CMAKE_CXX_COMPILER:            /usr/bin/c++
    -- HEXL_ENABLE_ADDRESS_SANITIZER: OFF
    -- HEXL_ENABLE_THREAD_SANITIZER:  OFF
    -- HEXL_ENABLE_UB_SANITIZER:      OFF
    -- HEXL_BENCHMARK:                ON
    -- HEXL_COVERAGE:                 OFF
    -- HEXL_DEBUG:                    OFF
    -- HEXL_DOCS:                     OFF
    -- HEXL_EXPORT:                   OFF
    -- HEXL_SHARED_LIB:               OFF
    -- HEXL_TESTING:                  ON
    -- HEXL_TREAT_WARNING_AS_ERROR:   OFF
    -- HEXL_USE_GNU:                  ON
    -- CMAKE_CXX_FLAGS_DEBUG -g
    -- CMAKE_CXX_FLAGS_RELEASE -O3 -DNDEBUG
    -- CMAKE_CXX_FLAGS_MINSIZEREL -Os -DNDEBUG
    -- CMAKE_CXX_FLAGS_RELWITHDEBINFO -O2 -g -DNDEBUG
    -- CMAKE_CXX_FLAGS
    -- Compile flag not found: HEXL_HAS_AVX512DQ
    -- Compile flag not found: HEXL_HAS_AVX512IFMA
    -- Compile flag not found: HEXL_HAS_AVX512VBMI2
    -- Setting HEXL_HAS_AVX256
    -- CMAKE_INSTALL_LIBDIR:     lib
    -- CMAKE_INSTALL_INCLUDEDIR: include
    -- CMAKE_INSTALL_PREFIX:     /usr/local
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/mssn/workspace/lab/hexl/build/cmake/cpu-features/cpu-features-download
    [100%] Built target cpu_features
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/mssn/workspace/lab/hexl/build/cmake/gtest/gtest-download
    [100%] Built target gtest
    CMake Deprecation Warning at build/cmake/gtest/gtest-src/CMakeLists.txt:4 (cmake_minimum_required):
      Compatibility with CMake < 2.8.12 will be removed from a future version of
      CMake.
    
      Update the VERSION argument <min> value or use a ...<max> suffix to tell
      CMake that the project does not need compatibility with older versions.
    
    
    CMake Deprecation Warning at build/cmake/gtest/gtest-src/googlemock/CMakeLists.txt:45 (cmake_minimum_required):
      Compatibility with CMake < 2.8.12 will be removed from a future version of
      CMake.
    
      Update the VERSION argument <min> value or use a ...<max> suffix to tell
      CMake that the project does not need compatibility with older versions.
    
    
    CMake Deprecation Warning at build/cmake/gtest/gtest-src/googletest/CMakeLists.txt:56 (cmake_minimum_required):
      Compatibility with CMake < 2.8.12 will be removed from a future version of
      CMake.
    
      Update the VERSION argument <min> value or use a ...<max> suffix to tell
      CMake that the project does not need compatibility with older versions.
    
    
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/mssn/workspace/lab/hexl/build/cmake/gbenchmark/gbenchmark-download
    [ 11%] Performing download step (git clone) for 'gbenchmark'
    Cloning into 'gbenchmark-src'...
    fatal: invalid reference: master
    CMake Error at gbenchmark-download/gbenchmark-prefix/tmp/gbenchmark-gitclone.cmake:40 (message):
      Failed to checkout tag: 'master'
    
    
    make[2]: *** [CMakeFiles/gbenchmark.dir/build.make:99: gbenchmark-prefix/src/gbenchmark-stamp/gbenchmark-download] Error 1
    make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/gbenchmark.dir/all] Error 2
    make: *** [Makefile:91: all] Error 2
    CMake Error at cmake/gbenchmark/CMakeLists.txt:17 (message):
      Build step for gbenchmark failed: 2
    
    
    -- Configuring incomplete, errors occurred!
    See also "/home/mssn/workspace/lab/hexl/build/CMakeFiles/CMakeOutput.log".
    See also "/home/mssn/workspace/lab/hexl/build/CMakeFiles/CMakeError.log".
    
    opened by musaprg 2
  • tried to build the docker file getting this error

    tried to build the docker file getting this error

    mac osx 12.1 docker version 4.6.1 hexl version v1.2.4

    7 393.9 [ 86%] Linking CXX executable ../bin/benchmark/poly-benchmark-16k #7 394.7 [ 86%] Built target compare-bfvrns-vs-bfvrnsB #7 394.8 [ 86%] Built target poly-benchmark-16k #7 395.1 [ 87%] Linking CXX executable ../../bin/examples/pke/depth-bfvrns #7 395.3 [ 87%] Built target depth-bfvrns #7 395.6 [ 87%] Linking CXX executable ../bin/benchmark/poly-benchmark-4k #7 395.8 [ 87%] Linking CXX executable ../../bin/examples/pke/evalatindex #7 395.8 [ 88%] Linking CXX executable ../../bin/examples/pke/depth-bfvrns-b #7 396.0 [ 88%] Built target poly-benchmark-4k #7 396.3 [ 88%] Built target depth-bfvrns-b #7 396.5 [ 88%] Built target evalatindex #7 396.7 [ 88%] Linking CXX executable ../../bin/examples/pke/depth-bgvrns #7 397.3 [ 88%] Built target depth-bgvrns #7 399.4 [ 88%] Linking CXX executable ../bin/benchmark/lib-benchmark #7 399.9 [ 88%] Built target lib-benchmark #7 401.7 [ 89%] Linking CXX executable ../../bin/examples/pke/threshold-fhe #7 402.2 [ 89%] Built target threshold-fhe #7 402.7 [ 90%] Linking CXX executable ../bin/benchmark/VectorMath #7 403.1 [ 90%] Built target VectorMath #7 407.7 [ 91%] Linking CXX executable ../bin/benchmark/lib-hexl-benchmark #7 408.2 [ 91%] Built target lib-hexl-benchmark #7 443.1 [ 92%] Linking CXX executable ../bin/benchmark/serialize-ckks #7 443.4 [ 92%] Built target serialize-ckks #7 444.7 make[1]: *** [CMakeFiles/Makefile2:1406: src/pke/CMakeFiles/pke_tests.dir/all] Error 2 #7 445.3 [ 93%] Linking CXX executable ../../bin/examples/pke/simple-integers-serial-bgvrns #7 445.5 [ 93%] Built target simple-integers-serial-bgvrns #7 451.7 [ 93%] Linking CXX executable ../../bin/examples/pke/simple-integers-serial #7 451.9 [ 93%] Built target simple-integers-serial #7 451.9 make: *** [Makefile:149: all] Error 2

    executor failed running [/bin/sh -c tar -zxvf libs.tar.gz && cd /libs/hexl && cmake -S . -B build && cmake --build build -j && cmake --install build && cd /libs/GSL && cmake -S . -B build -DGSL_TEST=OFF && cmake --build build -j && cmake --install build && cd /libs/zlib && cmake -S . -B build && cmake --build build -j && cmake --install build && cd /libs/zstd/build/cmake && cmake -S . -B build -DZSTD_BUILD_PROGRAMS=OFF -DZSTD_BUILD_SHARED=OFF -DZSTD_BUILD_STATIC=ON -DZSTD_BUILD_TESTS=OFF -DZSTD_MULTITHREAD_SUPPORT=OFF && cmake --build build -j && cmake --install build && cd /libs/SEAL && cmake -S . -B build -DSEAL_BUILD_DEPS=OFF -DSEAL_USE_INTEL_HEXL=ON -DHEXL_DIR=/usr/local/lib/cmake/hexl-1.2.3/ && cmake --build build -j && cmake --install build && cd /libs/palisade-release && cmake -S . -B build -DWITH_INTEL_HEXL=ON -DINTEL_HEXL_PREBUILT=ON -DINTEL_HEXL_HINT_DIR=/usr/local/lib/cmake/hexl-1.2.3/ && cmake --build build -j && cmake --install build && cd /libs/HElib && cmake -S . -B build -DUSE_INTEL_HEXL=ON -DHEXL_DIR=/usr/local/lib/cmake/hexl-1.2.3/ && cmake --build build -j && cmake --install build]: exit code: 2

    opened by martystack 1
  • Add HEXL-FPGA compatibility for DyadicMultiply and KeySwitch

    Add HEXL-FPGA compatibility for DyadicMultiply and KeySwitch

    Added an internal implementation for DyadicMultiply and KeySwitch and a CMake option and compiler flag to disable the normal DyadicMultiply and KeySwitch and only leave the internal one available. This makes HEXL compatible with HEXL-FPGA. With this both libraries can use HEXL's header but HEXL-FPGA can override DyadicMultiply and KeySwitch with its own implementation while leaving the internal implementation as a fallback if the user desires to use the CPU implementation.

    Renamed all instances of CKKS in all functions and file names.

    Added a new root_of_unity_powers_ptr option to KeySwitch. This option will be used in HEXL-FPGA.

    opened by tgonzalez89-intel 1
  • Wrong cmake condition in the main CMakeLists.txt

    Wrong cmake condition in the main CMakeLists.txt

    I guess the cmake condition testing whether to use GNUInstallDirs below should be UNIX, not LINUX, following here.

    From my experiment it didn't work for my ubuntu 20.04 environment.

    https://github.com/intel/hexl/blob/3b7e2d54e4fcdc5ffb6448b9323076f6844e6b65/CMakeLists.txt#L124

    bug 
    opened by wkjung 1
  • Add AVX512IFMA implementation of EltwiseMultMod

    Add AVX512IFMA implementation of EltwiseMultMod

    Add AVX512IFMA implementation of EltwiseMultMod. Performance appears similar to the AVX512DQ floating-point implementation, but we might as well add this implementation for reference.

    Also do some general cleanup, including:

    • rename __m512i variables with v_ prefix
    • renaming numbered __m512i variables with `_ suffix.

    Running ./build/benchmark/bench_hexl --benchmark_filter=MultModAVX512 on ICX yields

    Benchmark                                       Time             CPU   Iterations
    ---------------------------------------------------------------------------------
    BM_EltwiseMultModAVX512Float/1024/1         0.249 us        0.249 us      2809425
    BM_EltwiseMultModAVX512Float/4096/1          1.02 us         1.02 us       683180
    BM_EltwiseMultModAVX512Float/16384/1         4.16 us         4.16 us       160239
    BM_EltwiseMultModAVX512Float/1024/2         0.249 us        0.249 us      2808797
    BM_EltwiseMultModAVX512Float/4096/2          1.03 us         1.02 us       682916
    BM_EltwiseMultModAVX512Float/16384/2         4.57 us         4.57 us       168136
    BM_EltwiseMultModAVX512Float/1024/4         0.250 us        0.249 us      2807645
    BM_EltwiseMultModAVX512Float/4096/4          1.03 us         1.02 us       683757
    BM_EltwiseMultModAVX512Float/16384/4         4.37 us         4.37 us       168239
    BM_EltwiseMultModAVX512DQInt/1024/1         0.926 us        0.924 us       757593
    BM_EltwiseMultModAVX512DQInt/4096/1          3.47 us         3.45 us       203156
    BM_EltwiseMultModAVX512DQInt/16384/1         14.1 us         14.0 us        50117
    BM_EltwiseMultModAVX512DQInt/1024/2          1.04 us         1.03 us       676372
    BM_EltwiseMultModAVX512DQInt/4096/2          3.98 us         3.95 us       177213
    BM_EltwiseMultModAVX512DQInt/16384/2         16.0 us         15.9 us        43990
    BM_EltwiseMultModAVX512DQInt/1024/4          1.16 us         1.15 us       607127
    BM_EltwiseMultModAVX512DQInt/4096/4          4.42 us         4.40 us       159278
    BM_EltwiseMultModAVX512DQInt/16384/4         17.7 us         17.6 us        38850
    BM_EltwiseMultModAVX512IFMAInt/1024/1       0.313 us        0.311 us      2247005
    BM_EltwiseMultModAVX512IFMAInt/4096/1        1.07 us         1.06 us       658486
    BM_EltwiseMultModAVX512IFMAInt/16384/1       4.54 us         4.52 us       173616
    BM_EltwiseMultModAVX512IFMAInt/1024/2       0.299 us        0.298 us      2351467
    BM_EltwiseMultModAVX512IFMAInt/4096/2        1.05 us         1.05 us       668515
    BM_EltwiseMultModAVX512IFMAInt/16384/2       4.34 us         4.33 us       174641
    BM_EltwiseMultModAVX512IFMAInt/1024/4       0.300 us        0.299 us      2340499
    BM_EltwiseMultModAVX512IFMAInt/4096/4        1.05 us         1.05 us       667929
    BM_EltwiseMultModAVX512IFMAInt/16384/4       4.02 us         4.01 us       174560
    
    opened by fboemer 1
Releases(v1.2.5)
  • v1.2.5(Aug 8, 2022)

    • Adds experimental FFT-like (https://github.com/intel/hexl/pull/104)
    • Adds big moduli tests for IFMA (https://github.com/intel/hexl/pull/123)
    • Fixes HEXL's example build (https://github.com/intel/hexl/pull/114)
    • Fixes IFMA/DQ logic error (https://github.com/intel/hexl/pull/118)
    • Fixes pre-built CpuFeatures Error (https://github.com/intel/hexl/pull/120)
    • Fixes 52-bit modulus issue https://github.com/intel/hexl/issues/121 (https://github.com/intel/hexl/pull/123)
    • Updates to documentation

    Co-Authored-by: @joserochh Co-Authored-by: @hamishun Co-Authored-by: @jlhcrawford

    Full Changelog: https://github.com/intel/hexl/compare/v1.2.4...v1.2.5

    Source code(tar.gz)
    Source code(zip)
  • v1.2.4(Mar 18, 2022)

    • Adds experimental HEXL-FPGA compatibility for dyadic multiply and key switch (https://github.com/intel/hexl/pull/109)
    • Adds vcpkg example of how to use previous HEXL versions (https://github.com/intel/hexl/pull/103)
    • Adds benchmarking Montgomery multiplication (https://github.com/intel/hexl/pull/94)
    • Moves to compiling with minimum C++ 17
    • Updates to documentation

    Co-Authored-by: @fboemer Co-Authored-by: @joserochh Co-Authored-by: @GelilaSeifu Co-Authored-by: @hamishun Co-Authored-by: @jlhcrawford Co-Authored-by: @skmono Co-Authored-by: @ajagann Co-Authored-by: @ymeng-git Co-Authored-by: @tgonzalez89-intel

    Full Changelog: https://github.com/intel/hexl/compare/v1.2.3...v1.2.4

    Source code(tar.gz)
    Source code(zip)
  • v1.2.3(Nov 3, 2021)

    • Fix to EltwiseReduceMod on AVX512-DQ processors (https://github.com/intel/hexl/issues/86)
    • Update minimum CMake version to 3.13
    • Fixes 3rd-party dependency commits (https://github.com/intel/hexl/pull/85)

    Co-Authored-by: @fboemer Co-Authored-by: @joserochh Co-Authored-by: @GelilaSeifu Co-Authored-by: @fdiasmor

    Full Changelog: https://github.com/intel/hexl/compare/v1.2.2...v1.2.3

    Source code(tar.gz)
    Source code(zip)
  • v1.2.2(Oct 23, 2021)

    • Fixes Barrett reduce native benchmark (https://github.com/intel/hexl/pull/65)
    • Fixes 32 bit invntt (https://github.com/intel/hexl/pull/73)
    • Fixes CMake 3.13 compilation (https://github.com/intel/hexl/pull/67)
    • Added information of HElib integration to README (https://github.com/intel/hexl/pull/63)
    • Added random number generator which generates a vector of specified size with random values drawn uniformly from [0, modulus) (https://github.com/intel/hexl/pull/62)
    • Added random input values for benchmarks (https://github.com/intel/hexl/pull/66)
    • Uses Generalized Barrett Reduction algorithm for EltwiseMultMod (https://github.com/intel/hexl/pull/68)
    • Avoids memcpy operations on NTT (https://github.com/intel/hexl/pull/72)
    • Added performance tips to README (https://github.com/intel/hexl/pull/74)
    • Improves performance of Barrett Reduction (https://github.com/intel/hexl/pull/75)

    Co-Authored-by: @fboemer Co-Authored-by: @joserochh Co-Authored-by: @GelilaSeifu

    Source code(tar.gz)
    Source code(zip)
  • v1.2.1(Sep 2, 2021)

    • Fixes a bug in AVX512 floating-point implementation of element-wise vector-vector modular multiplication (https://github.com/microsoft/SEAL/issues/385)
    • Fixes a bug in the NTT default constructor (https://gitlab.com/palisade/palisade-development/-/issues/329)
    • Fixes a bug in the AVX512 NTT (https://github.com/intel/hexl/pull/58)
    • Improves performance of EltwiseFMAModAVX512 on ICX (https://github.com/intel/hexl/pull/42)
    • Improves performance of the native NTT
    • Adds reference implementations for the radix-4 NTT
    • Enables support for pre-built easylogging (https://github.com/intel/hexl/pull/57)

    Co-Authored-by: @fboemer Co-Authored-by: @GelilaSeifu Co-Authored-by: @jlhcrawford Co-Authored-by: @ajagann Co-Authored-by: @hamishun

    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Jul 26, 2021)

    Changes

    • Large performance improvement in large (N >= 16384) AVX512 NTTs via recursive implementations
    • Slight performance improvements in AVX512IFMA NTT
    • Slight performance improvements in element-wise modular multiplication
    • Implement optimized AVX512DQ NTT for moduli < 32 bits
    • Expands public API to include number theory, NTT twiddle factors
    • Remove HEXL_DEBUG and HEXL_EXPORT options. The behavior now is to always export the cmake configuration files, and HEXL_DEBUG is enabled iff the CMAKE_BUILD_TYPE=Debug
    • Added pkgconfig support

    Co-Authored-by: @fboemer Co-Authored-by: @GelilaSeifu Co-Authored-by: @jlhcrawford Co-Authored-by: @ajagann

    Source code(tar.gz)
    Source code(zip)
  • v1.1.1(Jun 4, 2021)

  • v1.1.0(May 10, 2021)

    Changes

    • Added vector-vector and vector-scalar EltwiseSubMod
    • Added vector-scalar version of EltwiseAddMod
    • Added generic 128-bit division for Windows build
    • Documentation hosted on a separate branch
    • Enabled custom allocator for NTT class
    • Fixed argument order in EltwiseReduceMod
    • Fixed build warnings on Windows and Mac
    Source code(tar.gz)
    Source code(zip)
  • v1.0.1(May 10, 2021)

    Changes

    • Remove intel- prefix from headers and library name
    • Fix CMake variables from 3rd party libraries from leaking
    • Fix warnings when HEXL_DEBUG=ON
    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(May 10, 2021)

Owner
Intel Corporation
Intel Corporation
Libraries and tools to perform fully homomorphic encryption operations on an encrypted data set.

Fully Homomorphic Encryption (FHE) This repository contains open-source libraries and tools to perform fully homomorphic encryption (FHE) operations o

Google 2.7k Aug 4, 2022
Homomorphic Encryption PIR Postgres C/C++ Agregate Extension.

MuchPIR Demo Contact The MuchPIR Team: [email protected] What is PIR? Private Information Retrieval refers to the ability to query a database without disc

Escanor Liones 12 Jul 1, 2022
LibSWIFFT - A fast C/C++ library for the SWIFFT secure homomorphic hash function

LibSWIFFT - A fast C/C++ library for the SWIFFT secure homomorphic hash function Official Repository LibSWIFFT is a production-ready C/C++ library pro

Gvili Tech Ltd 21 Jun 19, 2021
MIRACL Cryptographic SDK: Multiprecision Integer and Rational Arithmetic Cryptographic Library is a C software library that is widely regarded by developers as the gold standard open source SDK for elliptic curve cryptography (ECC).

MIRACL What is MIRACL? Multiprecision Integer and Rational Arithmetic Cryptographic Library – the MIRACL Crypto SDK – is a C software library that is

MIRACL 491 Aug 5, 2022
Rubicon - a New Custom Encryption Algorithm/Tool

Rubicon - a New Custom Encryption Algorithm/Tool Disclaimer DO NOT use this project for purposes other than legitimate red teaming/pentesting jobs

null 25 Mar 12, 2022
In cryptography, a cipher is an algorithm for performing encryption or decryption.

Cipher 1.0 In cryptography, a cipher is an algorithm for performing encryption or decryption. What can be done using this program? This program can us

null 1 Apr 21, 2022
FractalCrypt - Free cryptoarchiver permitting any number of hidden volumes for deniable encryption

FractalCrypt - Free cryptoarchiver permitting any number of hidden volumes for deniable encryption

Ivan Serov 347 Jul 22, 2022
obfuscated any constant encryption in compile time on any platform

oxorany 带有混淆的编译时任意常量加密 English 介绍 我们综合了开源项目ollvm、xorstr一些实现思路,以及c++14标准中新加入的constexpr关键字和一些模板的知识,完成了编译时的任意常量的混淆(可选)和加密功能。

Chase 91 Aug 2, 2022
Oceantoo is an XOR/LFSR based encryption algorithm

Oceantoo Oceantoo is an XOR/LFSR based encryption algorithm What is an LFSR? A linear-feedback shift register (LFSR) is a method of manipulating a num

Gary Explains 7 Aug 2, 2022
a new encryption algorithm that uses increments instead of XOR

incrypt a new encryption algorithm that uses increments instead of XOR. how to compile for linux: gcc incrypt.c -o incrypt gcc dicrypt.c -o dicrypt ho

man_s_our 1 Nov 24, 2021
inetd-style TLS encryption wrapper

Description The tlswrapper is an TLS encryption wrapper between remote client and local program prog. Is executed from systemd.socket/inetd/tcpserver/

Jan Mojžíš 2 Feb 23, 2022
Transparent file encryption in git

git-crypt - transparent file encryption in git git-crypt enables transparent encryption and decryption of files in a git repository. Files which you c

Andrew Ayer 6.7k Aug 6, 2022
Collection of common encryption.

EasyCipher 概述 EasyCipher收集了几种常见的加密方法的C语言实现,并基于Android平台封装了jni接口。 提供的加密方法包括 AES加密核心部分,不涉及模式和padding,支持128bits和256bits AES/CBC/PKCS5Padding SHA256 HAMC-

Billy Wei 6 Jun 9, 2022
An implementation of Advanced Encryption Standard with calculative optimization

An implementation of Advanced Encryption Standard with calculative optimization. Complete round operations in a single function.

Echo Heath 1 Jan 24, 2022
Linux rootkit used to hide a cryptominer process and CPU usage.

Linux rootkit used to hide a cryptominer process and CPU usage.

Alfon 37 Jul 31, 2022
CoinBrowser is a tool for Freqtrade where the program writes pairs into text file to be used with spesific exchange.

CoinBrowser CoinBrowser is a tool for Freqtrade where the program writes pairs into text file to be used with spesific exchange. Data for this program

null 23 Jul 31, 2022
The Keccak (SHA-3) hash used by Ethereum.

The Keccak (SHA3) digest for Ruby This Ruby extension exposes the Keccak (SHA3) digest C bindings in the non-final version used by Ethereum. It is bas

Afr Schoe 15 Jun 7, 2022
free C++ class library of cryptographic schemes

Crypto++: free C++ Class Library of Cryptographic Schemes Version 8.4 - TBD Crypto++ Library is a free C++ class library of cryptographic schemes. Cu

null 3.5k Aug 6, 2022