HElib | source software library | Cryptography library
kandi X-RAY | HElib Summary
kandi X-RAY | HElib Summary
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. (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. please refer to [ckks-security.md] ckks-security.md) for the latest discussion on the security of the ckks scheme implementation in helib. 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. helib supports an "assembly language for he", providing low-level routines
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of HElib
HElib Key Features
HElib Examples and Code Snippets
Community Discussions
Trending Discussions on HElib
QUESTION
To all he-experts out there:
I want to implement a matrix-vector multiplication with very large matrices (600000 x 55). Currently I am able to perform he operations like Addition, Multiplication, InnerProduct etc. with small inputs. When I try to apply these operations on larger inputs I get errors like Invalid next size (normal)
or I ran out of main memory until the os kills the process (exit code 9).
Do you have any recommendations/examples how to archive an efficient way of implementing a matrix-vector multiplication or something similar? (Using BFV and CKKS).
PS: I am using the PALISADE library but if you have better suggestions like SEAL or Helib I would happily use them as well.
...ANSWER
Answered 2020-Aug-04 at 14:20CKKS, which is also available in PALISADE, would be a much better option for your scenario as it supports approximate (floating-point-like) arithmetic and does not require high precision (large plaintext modulus). BFV performs all operations exactly (mod plaintext modulus). You would have to use a really large plaintext modulus to make sure your result does not wrap around the plaintext modulus. This gets much worse as you increase the depth, e.g., two chained multiplications.
For matrix-vector multiplication, you could use the techniques described in https://eprint.iacr.org/2019/223, https://eprint.iacr.org/2018/254, and the supplemental information of https://eprint.iacr.org/2020/563. The main idea is to choose the right encoding and take advantage of SIMD packing. You would work with a power-of-two vector size and could pack the matrix either as 64xY (multiple rows) per ciphertext or a part of each row per ciphertext, depending on which one is more efficient.
QUESTION
I get the following error while reading from boost::archive::binary_iarchive
into my variable:
ANSWER
Answered 2020-May-29 at 02:21
vector
strikes again
It's actually allocating for 0x1fffffffff20000 bits (that's 144 petabits) on my test box. That's coming directly from IndexSet::resize().
Now I have serious questions about HElib using std::vector
here (it seems they would be far better served with something like boost::icl::interval_set<>
).
Well. That was a wild goose chase (that IndexSet serialization can be much improved). However, the real problem is that you had Undefined Behaviour because you don't deserialize the same type as you serialize.
You serialize a PubKey
, but attempt to deserialize as PubKey*
. Uhoh.
Now beyond that, there's quite a bit of problems:
You had to modify the library to make private members public. This can easily violate ODR (making the class layout incompatible).
You seem to treat the context as a "dynamic" resource, which will engage Object Tracking. This could be a viable approach. BUT. You'll have to think about ownership.
It seems like you didn't do that yet. For example, the line in
load_construct_data
forDoublCRT
is a definite memory-leak:
QUESTION
a C++ code built into a shared library for HELib is using NTL and GMP static library. But it gets following error:
/usr/bin/ld: /usr/local/lib/libntl.a(FFT.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libntl.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status
It was suggested int the post Click here
to recompile NTL and GMP with "-fPIC " flags. I'am not able to find how I should do that.
Edit:
I'm able to build the shared library now after :
recompiling GMP and NTL by:
./configure --enable-shared
for gmp and
./configure SHARED=on
After make Install of HELib. I get error when I run the example codes. The link to the Makefile : click to see makefile
Error:
...g++ -g -O2 -std=c++11 -pthread -DFHE_THREADS -DFHE_BOOT_THREADS -DFHE_DCRT_THREADS -o Test_General_x Test_General.cpp -L/usr/local/lib -lntl -lgmp -lm -lfhe /usr/local/lib/libfhe.so: undefined reference to
write_raw_int(std::ostream&, long, long)' /usr/local/lib/libfhe.so: undefined reference to
read_raw_ZZ(std::istream&, NTL::ZZ&)' /usr/local/lib/libfhe.so: undefined reference tovoid write_raw_vector(std::ostream&, std::vector > const&)' /usr/local/lib/libfhe.so: undefined reference to
writeEyeCatcher(std::ostream&, char const*)' /usr/local/lib/libfhe.so: undefined reference towrite_raw_xdouble(std::ostream&, NTL::xdouble)' /usr/local/lib/libfhe.so: undefined reference to
read_ntl_vec_long(std::istream&, NTL::Vec&)' /usr/local/lib/libfhe.so: undefined reference tovoid read_raw_vector(std::istream&, std::vector >&)' /usr/local/lib/libfhe.so: undefined reference to
readEyeCatcher(std::istream&, char const*)' /usr/local/lib/libfhe.so: undefined reference toread_raw_int(std::istream&, long)' /usr/local/lib/libfhe.so: undefined reference to
read_raw_xdouble(std::istream&)' /usr/local/lib/libfhe.so: undefined reference towrite_raw_ZZ(std::ostream&, NTL::ZZ const&)' /usr/local/lib/libfhe.so: undefined reference to
write_ntl_vec_long(std::ostream&, NTL::Vec const&, long)' collect2: error: ld returned 1 exit status Makefile:179: recipe for target 'Test_General_x' failed make: *** [Test_General_x] Error 1
ANSWER
Answered 2019-Jan-19 at 11:34Marc Glisse provided the answer for the first two parts of the question.For the third part "Undefined Reference error" the answer is I'd not compiled and linked a x.cpp containing the functions that caused the undefined reference into my shared library. hence check : nm -CD /usr/local/lib/libfhe.so to see if these functions are listed with a linking address or not. If not then check which code provides this functionality. Link that code to the shared library.
QUESTION
How do you implement truncation in homomorphic encryption libraries like HELib or SEAL when no division operation is allowed?
I have two floating point numbers a=2.3,b=1.5
which I scale to integers with 2-digit precision. Hence my encoder looks basically like this encode(x)=x*10^2
. Assuming enc(x)
is the encryption function, then enc(encode(a))=enc(230)
and enc(encode(b))=enc(150)
.
Upon multiplication we obtain the huge value of a*b=enc(23*15)=enc(34500)
because the scaling factors multiply too. This means that my inputs grow exponentially unless I can truncate the result, so that trunate(enc(34500))=truncate(enc(345))
.
I assume such a truncation function is not possible because it cant be represented by a polynomial. Nonetheless, I wonder if there is any trick on how to perform this truncation mathematically or whether it is just an unsolved problem?
...ANSWER
Answered 2018-Sep-03 at 18:28It is possible but difficult to perform such truncation in the BFV and BGV schemes, and is unlikely to result in acceptable performance in most use-cases. This problem is very much related to the complexity of bootstrapping said schemes; for more details, see https://eprint.iacr.org/2018/067 and https://eprint.iacr.org/2014/873.
On the other hand, truncation is much easier to achieve in the CKKS scheme (see https://eprint.iacr.org/2016/421) where it is a natural operation. However, the downside of the CKKS scheme is that all computations only yield approximately correct results which may not be what you want.
QUESTION
I am trying to use Pyfhel library to perform some operations on encrypted integer list. But while performing subtraction operation, when negative values are expected, I am getting a different value.
...ANSWER
Answered 2018-Apr-10 at 13:31print(abc[0][0] - p) yields the expected output because we are working modulo p.
QUESTION
I am reading HELib’s source code and come across the following class definition:
...ANSWER
Answered 2017-Feb-07 at 05:53It is not the return type, it is the const keyword. If you call the method on a const instance of the class, the const method will be called.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install HElib
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page