Skip to content

Commit

Permalink
Added Helper bootsSymEncrypt
Browse files Browse the repository at this point in the history
  • Loading branch information
nindanaoto committed Oct 23, 2024
1 parent efbe147 commit 260ec8d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions include/tlwe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,24 @@ typename P::T tlweSymIntDecrypt(const TLWE<P> &c, const Key<P> &key)
return tlweSymIntDecrypt<P, P::plain_modulus>(c, key);
}

template <class P>
template <class P, typename P::T μ>
std::vector<TLWE<P>> bootsSymEncrypt(const std::vector<uint8_t> &p,
const Key<P> &key)
{
vector<TLWE<P>> c(p.size());
#pragma omp parallel for
for (int i = 0; i < p.size(); i++)
c[i] = tlweSymEncrypt<P>(p[i] ? P::μ : -P::μ, key);
c[i] = tlweSymEncrypt<P>(p[i] ? μ : -μ, key);
return c;
}

template <class P>
std::vector<TLWE<P>> bootsSymEncrypt(const std::vector<uint8_t> &p,
const Key<P> &key)
{
return bootsSymEncrypt<P, typename P::T>(p, key);
}

template <class P = lvl1param>
std::vector<TLWE<P>> bootsSymEncrypt(const std::vector<uint8_t> &p,
const SecretKey &sk)
Expand Down

0 comments on commit 260ec8d

Please sign in to comment.