Implementation of Add, Sub, Mult, Div in TFHE for Bin, ShortInt, Int

Hi!

I am studying TFHErs. I would love to see the implementation of Addition, Multiplication and Division of two Ciphertext or one plaintext and one ciphertext. I would really appreciate if someone could help with it.

I have few more questions,

  1. Does Boolean means just a single bit - 0 or 1? OR it could be a string of 0 and 1s?
  2. Does short integer mean 8 bit number and anything beyond that is considered as integer?

Thanks very much.

Hi!

  1. TFHE-rs booleans encrypt single bits, but you can of course use multiple ciphertexts to encrypt multiple values

  2. shortint are used to represent values that can fit in a single LweCiphertext, which is the most basic cryptographic entity used in TFHE-rs. The actual size of what can be encrypted inside a shortint depend of your parameter choice, for example with PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64 you encrypt 4 bits of plaintext, but 2 bits will be used to encode a message and 2 bits will be used to store a carry.

integer use several “blocks” of shortint ciphertexts. When you do integer operations, the carries are propagated from one block to the next.