homenc / HElib

HElib is an open-source software library that implements homomorphic encryption. It supports the BGV scheme with bootstrapping and the Approximate Number CKKS scheme. HElib also includes optimizations for efficient homomorphic evaluation, focusing on effective use of ciphertext packing techniques and on the Gentry-Halevi-Smart optimizations.
https://homenc.github.io/HElib
Other
3.12k stars 763 forks source link

About nSlots and m #122

Open alinan8868 opened 7 years ago

alinan8868 commented 7 years ago

Hello,everyone. I know #nslots = phi(m) / order(p, m), here phi() is the Euler's function, and order(p,m) is the multiplicative order of p given m. But I found that the same nslots can correspond to a lot of m. For example,when nslots=8,m can be 4145,4255,1157... If I want to compare the encryption time when nslots=8 and nslots=16 on the same string,how should I set the m to make it right . and is it security when m= 4145,4255,1157... ? Thanks :)

ssmiler commented 7 years ago

For a security estimate you can use function securityLevel() defined in FHEContext.h.

alinan8868 commented 7 years ago

@ssmiler ,Thanks :) How to solve the first problem?

ssmiler commented 7 years ago

@alinan8868 sorry I haven't understood your first problem

alinan8868 commented 7 years ago

@ssmiler I didn't find the function securityLevel() defined in FHEContext.h .

ssmiler commented 7 years ago

I can see it https://github.com/shaih/HElib/blob/master/src/FHEContext.h#L196 ;)

alinan8868 commented 7 years ago

@ssmiler yeah,I find it . What kind of value is safe?
Thanks

ssmiler commented 7 years ago

I'm not a cryptographer but I suppose at least 80

qichexiaozi commented 7 years ago

@alinan8868 hi,can you show me the parameters when your nslot=8. for example:p = ?,r = ?,d = ?,c = ?,k = ?,w = ?,L = ?,m = ?,thank you!

fionser commented 7 years ago

@qichexiaozi nslot = phi(m) / order(m, p) and has nothing with other parameters. So, basically, we first set k, and L and let d, c, w be the default values, and then set a larger enough p which satisfies your application domain, then find a proper m , e.g, through FindM function. At this point, we have decided all the parameters, while the nslot might be not large enough. We can either keep 1) changing m or 2) changing p until we find a (m, p) pairs that satisfies all things.

P.S order(m,p) is the multiplicative order of m given the modulo p.

NanXiao commented 7 years ago

@fionser shouldn't nslot = phi(m) / order(p, m)?