snucrypto / HEAAN

Other
359 stars 94 forks source link

Scheme::exp2piAndEqual #35

Open gamma-2017 opened 4 years ago

gamma-2017 commented 4 years ago

Why does Scheme::exp2piAndEqual not use logp=cipher.logp ?

gamma-2017 commented 4 years ago

In void Scheme::evalExpAndEqual, I replaced the line

    reScaleByAndEqual(c2, logT + 1); // c2 bitDown: logT + 1

with

    divByPo2AndEqual(c2, logT + 1); // c2 bitDown: logT + 1 // MN: Modified

Then Scheme::exp2piAndEqual is not called with logp != cipher.logp in case logSlots=logNh.

Is that a bug?

KyoohyungHan commented 4 years ago

First, exp2piAndEqual function is used in "bootstrapping" process. And during bootstrapping scaling factor is change temporary, so we do not use logp = cipher.logp.

About the second question, divByPo2AndEqual and reScaleByAndEqual are different algorithms. For example, divByPo2AndEqual does not change cipher.logp but reScaleByAndEqual changes it.