Skip to content

Commit

Permalink
Merge pull request #340 from faberga/master
Browse files Browse the repository at this point in the history
V1.0.0 Jan2020
  • Loading branch information
faberga authored Jan 10, 2020
2 parents cd267e2 + 4d2f63f commit 0e45868
Show file tree
Hide file tree
Showing 202 changed files with 10,786 additions and 5,104 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ src/misc/*.txt
!src/misc/iotest_asciiLE.txt
!src/misc/iotest_binBE.bin
!src/misc/iotest_binLE.bin
/html/
/latex/
6 changes: 2 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ project(helib_superbuild
# Define standard installation directories (GNU)
include(GNUInstallDirs)

## Use -std=c++11 as default.
set(CMAKE_CXX_STANDARD 11)
## Use -std=c++14 as default.
set(CMAKE_CXX_STANDARD 14)
## Disable C++ extensions
set(CMAKE_CXX_EXTENSIONS OFF)
## Require full C++ standard
Expand Down Expand Up @@ -48,7 +48,6 @@ if (PACKAGE_BUILD)
else (PACKAGE_BUILD)
# Properties to be enabled when not using PACKAGE_BUILD
option(ENABLE_LEGACY_TEST "Build the legacy test files (does not work with PACKAGE_BUILD)" OFF)
option(BUILD_AES "Build homomorphic AES (does not work with PACKAGE_BUILD)" OFF)
endif(PACKAGE_BUILD)

# Allow GMP_DIR and search in it if not using PACKAGE_BUILD or using PACKAGE_BUILD and !FETCH_GMP
Expand Down Expand Up @@ -235,7 +234,6 @@ if (PACKAGE_BUILD)
-DFETCH_GMP=${FETCH_GMP}
-DENABLE_TEST=${ENABLE_TEST}
-DENABLE_LEGACY_TEST=OFF
-DBUILD_AES=OFF
BUILD_ALWAYS ON
)

Expand Down
2,697 changes: 374 additions & 2,323 deletions Doxyfile

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ set to `OFF`, there should either exist a system-installed GMP library, or

### Parameters specific to option 2 (library build)
- `ENABLE_LEGACY_TEST=ON/OFF` (default is OFF): Build old test system (deprecated).
- `BUILD_AES=ON/OFF` (default is OFF): Build homomorphic AES.
- `GMP_DIR`: Prefix of the GMP library.
- `NTL_DIR`: Prefix of the NTL library.

Expand Down
92 changes: 23 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,79 +1,32 @@
HElib
=====
***September-November 2019:*** Significant refactoring and cleanup of codebase.
New `helib` namespace. New `examples` and `benchmarks` directory trees.
Improvements to bootstrapping.
Better tests for bootsrapping and binary arithmetic in BGV.
Docs and example code for binary arithmetic.
Overall code and performance improvements in `NumbTh.cpp`.
HElib now avoids *very bad* generators.
Bug fixes.

***August 2019:*** Improved noise management in HElib.
Better and more robust bootstrapping algorithm.
Ubuntu 18.04 Docker image with HElib and its dependencies.
See install instructions in [DOCKER_USAGE.md](DOCKER_USAGE.md)

***July 2019:*** Added new bootstrapping and PGFFT tests.

***June 2019:*** Added implementation of PGFFT to replace Armadillo for FFTs in
the CKKS scheme. See comments in `PGFFT.h` for more information.

***May 2019:*** CKKS bug fixes and fixed compiler warnings.

***April 2019:*** Moved the HElib repository on github from shaih/HElib to
HomEnc/HElib. Introduced HElib-specific exceptions, replaced C `assert`, NTL
Error and `std::exception` to use HElib-specific assertions that throw the new
exceptions. See comments in `assertions.h` and `exceptions.h` for usage
information.

***March 2019:*** Introduced new test framework (google test), documented in
[TESTS.md](TESTS.md). Previous framework will be deprecated. Added a cmake
build script for building HElib and dependencies, documented in
[INSTALL.md](INSTALL.md). Added an example program, see `example program`.

***January 2019:*** Multiple changes: CKKS support, new modulus-chain
implementation, better noise management, etc. Documented in
[changes.md](changes.md)

***March 2018:*** Re-implementation of homomorphic linear transformations,
featuring speedups of 15x to 75x.
HElib is an open-source ([Apache License v2.0][5]) software library that
implements [homomorphic encryption][6] (HE). Currently available schemes
are the implementations of the [Brakerski-Gentry-Vaikuntanathan][1] (BGV)
scheme with [bootstrapping][8] and the Approximate Number scheme of
[Cheon-Kim-Kim-Song][9] (CKKS), along with many optimizations to make
homomorphic evaluation run faster, focusing mostly on effective use of
the [Smart-Vercauteren][2] ciphertext packing techniques and
the [Gentry-Halevi-Smart][3] optimizations. See [this report][7] for a
description of a few of the algorithms using in this library.

***Dec 2017-Jan 2018:*** Added some routines for addition/multiplication and
comparisons of integers in binary representation, and for homomorphic table
lookup. See the supported interfaces in `binaryArith.h`, `binaryCompare.h`,
and `tableLookup.h`. Some examples are in `Test_binaryArith.cpp`,
`Test_binaryCompare.cpp`, and `Test_tableLookup.cpp`.
Since mid-2018 HElib has been under extensive refactoring for *Reliability*,
*Robustness & Serviceability*, *Performance*, and most importantly *Usability*
for researchers and developers working on HE and its uses.

The inputs and outputs to the new routines are logically vectors of Ctxt objects
(one Ctxt per bit in the binary representation). These vectors are wrapped by
the new `CtPtrs` wrapper (see `CtPtrs.h` and the underlying `PtrsVector.h` and
`PtrsMatrix.h`). Hence the same logic will work for any type of input that can
be mapped logically to arrays of `Ctxt`s, as long as one can wrap them with the
same wrapper class. In particular, we implemented wrappers for
`std::vector<Ctxt>`, `std::vector<Ctxt*>`, `NTL::Vec<Ctxt>` and
`NTL::Vec<Ctxt*>`.
HElib supports an *"assembly language for HE"*, providing low-level routines
(set, add, multiply, shift, etc.), sophisticated automatic noise management,
improved BGV bootstrapping, multi-threading, and also support for Ptxt (plaintext)
objects which mimics the functionality of Ctxt (ciphertext) objects.
See [changes.md](changes.md) for more details.

-----------------------------------------------------------------------------
HElib is a software library that implements [homomorphic encryption][6] (HE).
Currently available is an implementation of the
[Brakerski-Gentry-Vaikuntanathan][1] (BGV) scheme, along with many
optimizations to make homomorphic evaluation runs faster, focusing mostly on
effective use of the [Smart-Vercauteren][2] ciphertext packing techniques and
the [Gentry-Halevi-Smart][3] optimizations. See [this report][7] for a
description of a few of the algorithms using in this library. Starting
December 2014, the library also includes [bootstrapping][8].
Full installation instructions can be found in [INSTALL.md](INSTALL.md).

At its present state, this library is mostly meant for researchers working on
HE and its uses. Also currently it is fairly low-level, and is best thought of
as "assembly language for HE". That is, it provides low-level routines (set,
add, multiply, shift, etc.), with as much access to optimizations as we can
give. Hopefully in time we will be able to provide higher-level routines.
HElib is written in C++14 and uses the [NTL mathematical library][4]
(version 11.0.0 or higher).
HElib is distributed under the terms of the [Apache License v2.0][5].

This library is written in C++ and uses the [NTL mathematical library][4]
(version 10.0.0 or higher). As of March 2015, it also supports multi-threading.
HElib is distributed under the terms of the [Apache License v2.0][5].
For more information see the [GitHub Pages][9].

[1]: http://eprint.iacr.org/2011/277 "BGV12"
[2]: http://eprint.iacr.org/2011/133 "SV11"
Expand All @@ -83,4 +36,5 @@ For more information see the [GitHub Pages][9].
[6]: http://en.wikipedia.org/wiki/Homomorphic_encryption "Homomorphic encryption"
[7]: http://eprint.iacr.org/2014/106 "algorithms"
[8]: http://eprint.iacr.org/2014/873 "bootstrapping"
[9]: https://github.com/homenc/HElib "GitHubPages"
[9]: http://eprint.iacr.org/2016/421 "CKKS16"
[10]: https://github.com/homenc/HElib "GitHubPages"
66 changes: 63 additions & 3 deletions changes.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,70 @@
HElib 1.0.0 beta1, August 2019
HElib 1.0.0, December 2019
===============================
(tagged as 1.0.0-Dec2019)

December 2019
-------------
* C++14 Standard (minimum level)
* New `Ptxt` Plaintext class that implements the same functionality of the `Ctxt` ciphertext class.
* Improved version of the `ArgMap` API for command line arguments.
* Restructuring of the project directory tree.
* Removed AES example - improved version on its way.
* Doxygen documentation.
* Bug fixes.

HElib 1.0.0 beta 2, November 2019
===============================
(tagged as 1.0.0-beta2-Nov2019)

September-November 2019
-----------------------
* Significant refactoring and cleanup of codebase.
* New `helib` namespace.
* New `examples` and `benchmarks` directory trees.
* Improvements to bootstrapping.
* Better tests for bootsrapping and binary arithmetic in BGV.
* Docs and example code for binary arithmetic.
* Overall code and performance improvements in `NumbTh.cpp`.
* HElib now avoids *very bad* generators.
* Bug fixes.

HElib 1.0.0 beta 1, August 2019
===============================
(tagged as 1.0.0-beta1-Aug2019)

This version includes a new test framework (google test) and CMake build environment. It also includes much more rigorous noise management and noise estimates, making it safe to use HElib's noise estimates to avoid decryption errors. Also a beefed up GPV bootstrapping, with much more rigorous selection of parameters. Finally, Armadillo was removed and replaced with a faster and simpler complex FFT representation.
August 2019
-----------
* Improved noise management in HElib.
* Better and more robust bootstrapping algorithm.

July 2019
---------
* Added new bootstrapping and PGFFT tests.

June 2019
---------
* Added implementation of PGFFT to replace Armadillo for FFTs in
the CKKS scheme. See comments in `PGFFT.h` for more information.

May 2019
--------
* CKKS bug fixes and fixed compiler warnings.

April 2019
----------
* Moved the HElib repository on github from shaih/HElib to HomEnc/HElib.
* Introduced HElib-specific exceptions, replaced C `assert`, NTL
* Error and `std::exception` to use HElib-specific assertions that throw the new exceptions.
* See comments in `assertions.h` and `exceptions.h` for usage information.

March 2019
----------
* Introduced new test framework (google test), documented in [TESTS.md](TESTS.md).
* Previous framework will be deprecated. Added a cmake build script for building HElib and dependencies, documented in [INSTALL.md](INSTALL.md).
* Added an example program, see `example program`.


HElib 1.0.0 beta, January 2019
HElib 1.0.0 beta 0, January 2019
===============================
(tagged as 1.0.0-beta0-Jan2019)

Expand Down
8 changes: 4 additions & 4 deletions examples/BGV_general_example/BGV_general_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int main(int argc, char *argv[]) {

std::cout << "Initialising context object..." << std::endl;
// Intialise context
helib::FHEcontext context(m, p, r);
helib::Context context(m, p, r);
// Modify the context, adding primes to the modulus chain
std::cout << "Building modulus chain..." << std::endl;
buildModChain(context, bits, c);
Expand All @@ -44,16 +44,16 @@ int main(int argc, char *argv[]) {
// Secret key management
std::cout << "Creating secret key..." << std::endl;
// Create a secret key associated with the context
helib::FHESecKey secret_key(context);
helib::SecKey secret_key(context);
// Generate the secret key
secret_key.GenSecKey();
std::cout << "Generating key-switching matrices..." << std::endl;
// Compute key-switching matrices that we need
helib::addSome1DMatrices(secret_key);

// Public key management
// Set the secret key (upcast: FHESecKey is a subclass of FHEPubKey)
const helib::FHEPubKey& public_key = secret_key;
// Set the secret key (upcast: SecKey is a subclass of PubKey)
const helib::PubKey& public_key = secret_key;

// Get the EncryptedArray of the context
const helib::EncryptedArray& ea = *(context.ea);
Expand Down
4 changes: 2 additions & 2 deletions examples/BGV_general_example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)

## Use -std=c++11 as default.
set(CMAKE_CXX_STANDARD 11)
## Use -std=c++14 as default.
set(CMAKE_CXX_STANDARD 14)
## Disable C++ extensions
set(CMAKE_CXX_EXTENSIONS OFF)
## Require full C++ standard
Expand Down
4 changes: 2 additions & 2 deletions examples/binaryArith_example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)

## Use -std=c++11 as default.
set(CMAKE_CXX_STANDARD 11)
## Use -std=c++14 as default.
set(CMAKE_CXX_STANDARD 14)
## Disable C++ extensions
set(CMAKE_CXX_EXTENSIONS OFF)
## Require full C++ standard
Expand Down
8 changes: 4 additions & 4 deletions examples/binaryArith_example/binaryArith_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ int main(int argc, char* argv[])

std::cout << "Initialising context object..." << std::endl;
// Intialise the context.
helib::FHEcontext context(m, p, r, gens, ords);
helib::Context context(m, p, r, gens, ords);

// Modify the context, adding primes to the modulus chain.
std::cout << "Building modulus chain..." << std::endl;
Expand All @@ -66,16 +66,16 @@ int main(int argc, char* argv[])
// Secret key management.
std::cout << "Creating secret key..." << std::endl;
// Create a secret key associated with the context.
helib::FHESecKey secret_key(context);
helib::SecKey secret_key(context);
// Generate the secret key.
secret_key.GenSecKey();

// Generate bootstrapping data.
secret_key.genRecryptData();

// Public key management.
// Set the secret key (upcast: FHESecKey is a subclass of FHEPubKey).
const helib::FHEPubKey& public_key = secret_key;
// Set the secret key (upcast: SecKey is a subclass of PubKey).
const helib::PubKey& public_key = secret_key;

// Get the EncryptedArray of the context.
const helib::EncryptedArray& ea = *(context.ea);
Expand Down
Loading

0 comments on commit 0e45868

Please sign in to comment.