forked from homenc/HElib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainpage.dox
165 lines (134 loc) · 7.29 KB
/
mainpage.dox
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/**
@mainpage HElib Documentation
HElib is a software library that implements homomorphic encryption
(HE). Currently available is an implementation of the
Brakerski-Gentry-Vaikuntanathan (BGV) scheme, along with many
optimizations to make homomorphic evaluation runs faster, focusing
mostly on effective use of the Smart-Vercauteren ciphertext packing
techniques and the Gentry-Halevi-Smart optimizations. Articles that
describe some aspects of HElib include:
- A (somewhat outdated) <a href="http://people.csail.mit.edu/shaih/pubs/he-library.pdf">design document</a>, Shai Halevi and Victor Shoup, April 2013.
- <a href="http://eprint.iacr.org/2014/106">Algorithms in HElib</a>, Shai Halevi and Victor Shoup, published in <a href="http://www.iacr.org/conferences/crypto2014/">CRYPTO 2014</a>.
- <a href="http://eprint.iacr.org/2014/873">Bootstrapping for HElib</a>, Shai Halevi and Victor Shoup, <a href="https://www.cosic.esat.kuleuven.be/eurocrypt_2015/">EUROCRYPT 2015</a>.
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.
This library is written in C++ and uses the NTL mathematical
library, over GMP. It is distributed under the terms of the
Apache License, Version 2.0.
\section building Building HElib
To build HElib, you will need to have GMP and NTL libraries installed.
Many distributions come with GMP pre-installed. If not, you can install
GMP as follows.
-# Download GMP from http://www.gmplib.org
-# Uncompress and cd into the directory `gmp-XXX`
-# On the command line:
@code
./configure
make
sudo make install
@endcode
This should install GMP into `/usr/local`.
Once GMP is installed, you can install NTL as follows:
(NOTE: you will needs NTL version 10.0.0 or higher)
-# Download NTL from http://www.shoup.net/ntl/
-# Uncompress and cd into the directory `ntl-XXX/src`
-# On the command line:
@code
./configure NTL_THREADS=on NTL_THREAD_BOOST=on NTL_EXCEPTIONS=on
make
sudo make install
@endcode
This should install NTL into `/usr/local`.
Now that you have these libraries in place, you can cd to the HElib
src directory to build HElib.
Right now, the "build system" for HElib is very rudimentary: no
configure script and just a Makefile (with no `make install`).
The Makefile will build the static library fhe.a in the HElib src
directory, and then one can build applications programs based on
fhe.a, also in the HElib src directory (or set the include and library
parameters to include the right things). Hopefully, this build system
will be improved in the future.
Before building HElib, you may want to look at the Makefile, and
consider adjusting some of the defaults for CC and CFLAGS. The
defaults should be OK on most systems, but you can see the suggested
options, which are documented in the Makefile.
On the command line in the HElib src directory:
@code
make # this will compile and build the library fhe.a
make check # this will compile and runs a series of test programs.
@endcode
If you want to build your own program based on HElib, the easiest way
to do it is to write the program in a file called myprog.cpp and then
run
@code
make myprog_x
@endcode
which will compile `myprog.cpp` and link in `fhe.a` and all required
support libraries, and create the executable `myprog_x`.
\subsection testProgs Test Programs
Take a look at the programs `Test_*.cpp` for examples of using HElib.
Those include:
- \ref `Test_General.cpp`.
A general test program that uses a mix of operations over four
ciphertexts.
- `Test_Timing.cpp`.
A program that tests the timing of various operations, outputs the
results in a comma-separate-value (csv) format.
- `Test_IO.cpp`.
Testing the I/O of the important classes of the library (context,
keys, ciphertexts).
- `Test_LinPoly.cpp`.
Testing the "linearized polynomials" functionality for computing intra-slot
linear functions (over the base field/ring). See algorithmic description in Section 2.8 of the <a href="http://eprint.iacr.org/2014/873">bootstrapping report</a>.
- `Test_matmul.cpp`.
Testing the functionality of multiplying an encrypted vector by a plaintext matrix, either over the extension- or the base-field/ring.
- `Test_Replicate.cpp`.
Testing the functionality of replicating one slot from a vector across the whole vector. (This can be done via the generic matrix-multiply routines, but HElib includes more efficient direct routines for this.)
- `Test_PolyEval.cpp`.
Testing the functionality of evaluating a plaintext polynomial at an encrypted point.
- `Test_Permutations.cpp`.
Testing the functionality of applying an arbitrary plaintext permutation to an encrypted vector.
- `Test_extractDigits.cpp`.
For a plaintext space modulo a prime-power \f$p^e\f$, testing the functionality of extracting the base-\f$p\f$ representation of an encrypted values. See algorithmic description in Section 5.3 of the <a href="http://eprint.iacr.org/2014/873">bootstrapping report</a>.
- `Test_EvalMap.cpp`.
Testing the linear transformations that are used for recryption/bootstrapping.
- `Test_bootstrapping.cpp`.
Testing the recryption procedure.
- `Test_binaryArith.cpp`.
Testing the implementation of integer arithmetic in binary representation
For a list of command-line arguments that any of these programs accepts, run
@code
Test_XYZ --help
@endcode
\subsection remarks Some comments
HElib uses some features of `C++11`. For gcc, depending on the version that you use, you may need to specify the flag '<tt>-std=c++11 -lstdc++</tt>' to be able to compile. There are several compilation flags that control some aspects of the library:
<dl>
<dt><tt>-DNO_HALF_SIZE_PRIME</tt></dt>
<dd> Tells HElib to not use the half size prime in the prime chain.
By default, the modulus-chain in HElib consists of many "full-size
primes" (of size n bits, typically n=50 or n=60 for 64-bit machines)
and one "half-size prime" of n/2 bits. A level corresponds to n/2
bits in the size of the modulus, and dropping to a lower level is
done either by dropping the half-size prime (if it is part of the
current modulus) or by dropping a full-size prime and adding back
the half-size prime (if it is not part of the current modulus).
Specifying the flag <tt>NO_HALF_SIZE_PRIME</tt> makes all the primes the
same size, with each prime corresponding to a level (so dropping to
a lower level means dropping one of the primes).
</dd>
<dt><tt>-DFHE_THREADS</tt></dt>
<dd> tells HElib to enable generic multithreading capabilities;
must be used with a thread-enabled NTL and the <tt>-pthread</tt>
flag should be passed to <tt>gcc</tt></dd>
<dt><tt>-DFHE_BOOT_THREADS</tt></dt>
<dd> tells HElib to use a multithreading strategy for bootstrapping;
requires <tt>-DFHE_THREADS</tt></dd>
<dt><tt>-DDEBUG_PRINTOUT</tt></dt>
<dd> Add some debugging printouts
</dd>
</dl>
**/