CKKS KeyGen and bootstrapping


I have a couple of questions about the secret key generation of CKKS and its bootstrapping.

  1. Here (openfhe-development/base-pke.cpp at 745a4920fd711d789d08d250f1f444bac23195fd · openfheorg/openfhe-development · GitHub) in the code, it seems like it is generating a secret key with hamming weight 16 in SPARSE_TERNARY case, but it says SPARSE_TERNARY uses hamming weight 64 in README. I would like to know if ‘16’ here does not denote the hamming weight.

  2. In the CKKS bootstrapping procedure, K_UNIFORM was set to 512 by default. Is this K here the range of the sine approximation? or is it (the range of approximation) * 2^r where r is the number of iterations for the double-angle formula?

Thank you,

Hi @ujinnam ,

  1. This is a bug. I’ve created an issue for it: Hamming weight for SPARSE_TERNARY · Issue #311 · openfheorg/openfhe-development · GitHub Thank you for reporting it. Everywhere else in OpenFHE, we set the Hamming weight to 64. Note that we do not recommend using sparse secrets in practice. TERNARY_UNIFORM should be used instead. There are several attacks for sparse secrets: On the Feasibility and Impact of Standardising Sparse-secret LWE Parameter Sets for Homomorphic Encryption
  2. K_UNIFORM is set to 512 to allow up to 512$q$-overflows after ModRaise. This corresponds to the full range of the sine function (after the last double-angle iteration).