HElib | source software library | Cryptography library

 by   homenc C++ Version: v2.2.2 License: Non-SPDX

kandi X-RAY | HElib Summary

kandi X-RAY | HElib Summary

HElib is a C++ library typically used in Security, Cryptography applications. HElib has no bugs, it has no vulnerabilities and it has medium support. However HElib has a Non-SPDX License. You can download it from GitHub.

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

            kandi-support Support

              HElib has a medium active ecosystem.
              It has 2979 star(s) with 737 fork(s). There are 201 watchers for this library.
              It had no major release in the last 12 months.
              There are 163 open issues and 194 have been closed. On average issues are closed in 91 days. There are 8 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of HElib is v2.2.2

            kandi-Quality Quality

              HElib has no bugs reported.

            kandi-Security Security

              HElib has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              HElib has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              HElib releases are available to install and integrate.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of HElib
            Get all kandi verified functions for this library.

            HElib Key Features

            No Key Features are available at this moment for HElib.

            HElib Examples and Code Snippets

            No Code Snippets are available at this moment for HElib.

            Community Discussions


            Homomorphic encryption: Matrix Vector multiplication using PALISADE library
            Asked 2020-Aug-13 at 07:08

            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.



            Answered 2020-Aug-04 at 14:20

            CKKS, 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.

            Source https://stackoverflow.com/questions/63242803


            Error using boost serialization with binary archive
            Asked 2020-May-29 at 05:04

            I get the following error while reading from boost::archive::binary_iarchive into my variable:



            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 for DoublCRT is a definite memory-leak:

            Source https://stackoverflow.com/questions/61895626


            How to recompile ntl and gmp libraries with "-fPIC" flag & make HELib as a shared library & undefined reference to func(std::ostream&) error
            Asked 2019-Jan-19 at 11:34

            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.


            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


            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 toread_raw_ZZ(std::istream&, NTL::ZZ&)' /usr/local/lib/libfhe.so: undefined reference to void write_raw_vector(std::ostream&, std::vector > const&)' /usr/local/lib/libfhe.so: undefined reference towriteEyeCatcher(std::ostream&, char const*)' /usr/local/lib/libfhe.so: undefined reference to write_raw_xdouble(std::ostream&, NTL::xdouble)' /usr/local/lib/libfhe.so: undefined reference toread_ntl_vec_long(std::istream&, NTL::Vec&)' /usr/local/lib/libfhe.so: undefined reference to void read_raw_vector(std::istream&, std::vector >&)' /usr/local/lib/libfhe.so: undefined reference toreadEyeCatcher(std::istream&, char const*)' /usr/local/lib/libfhe.so: undefined reference to read_raw_int(std::istream&, long)' /usr/local/lib/libfhe.so: undefined reference toread_raw_xdouble(std::istream&)' /usr/local/lib/libfhe.so: undefined reference to write_raw_ZZ(std::ostream&, NTL::ZZ const&)' /usr/local/lib/libfhe.so: undefined reference towrite_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



            Answered 2019-Jan-19 at 11:34

            Marc 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.

            Source https://stackoverflow.com/questions/54148692


            Truncation in Homomorphic Encryption
            Asked 2018-Sep-03 at 18:28

            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?



            Answered 2018-Sep-03 at 18:28

            It 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.

            Source https://stackoverflow.com/questions/52129790


            Pyfhel subtraction
            Asked 2018-Apr-19 at 13:31

            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.



            Answered 2018-Apr-10 at 13:31

            print(abc[0][0] - p) yields the expected output because we are working modulo p.

            Source https://stackoverflow.com/questions/49745649


            Function overloading by return const and not?
            Asked 2017-Feb-07 at 05:53

            I am reading HELib’s source code and come across the following class definition:



            Answered 2017-Feb-07 at 05:53

            It 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.

            Source https://stackoverflow.com/questions/42082634

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install HElib

            You can download it from GitHub.


            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries