Converting between GSW and LWE Ciphertext

I understand that the cmux function uses a GSW ciphertext as the selector bit (GswCiphertext in concrete_core::crypto::gsw - Rust). If I have a LWE ciphertext how do I convert it to a GSW one? Similarly, how do I convert a GSW one to an LWE ciphertext?

Hello @brelyn01 :wave: ,

Thanks for your interest in concrete :slightly_smiling_face: !

I can’t speak for the crypto side of things (if it would be possible to do such a thing theoretically), but for now, there is no entry point in concrete-core which allows you to go back and forth between an lwe and a gsw ciphertext.

The only thing you can do for now is to encrypt a plaintext as an Gsw ciphertext, with the LweSecretKey::encrypt_constant_gsw method (by the way, the name was mistakenly inspired by the equivalent ggsw method, but the constant word should not be here).

Best,

Alex

1 Like

Hi @brelyn01,

In theory there exist already techniques to convert LWE to GSW and vice versa.

  • To convert an LWE to a GSW (or GGSW) the Circuit Bootstrapping can be used;
  • To convert a GSW to an LWE it is a matter of simply “extracting one of the lines” composing the GSW ciphertext (generally the first line in the last block).

As @apere already said, these functions are not yet in Concrete, but we will consider to included these features in future releases :slight_smile:
May I ask what is your use-case by the way?

Best,
Ilaria