Types and Operations

The library exposes utility functions for TFHE operations. The goal of the library is to provide a seamless developer experience for writing smart contracts that can operate on confidential data.

Types

The library provides a type system that is checked both at compile time and at run time. The structure and operations related to these types are described in this sections.
We currently support encrypted integers of bit length up to 32 bits.
These encrypted integers behave as much as possible as Solidity's integer types. However, behaviour such as "revert on overflow" is not supported as this would leak some information of the encrypted integers. Therefore, arithmetic on euint types is unchecked, i.e. there is wrap-around on overlow.
In the back-end, encrypted integers are TFHE ciphertexts. The library abstracts away the ciphertexts and presents pointers to ciphertexts, or ciphertext handles, to the smart contract developer. The euint types are wrappers over these handles.

Operations

The library exposes utility functions for operations on TFHE ciphertexts. The list of supported operations is presented below.
name
type
Add
Binary
Sub
Binary
Mul
Binary
BitAnd
Binary
BitOr
Binary
BitXor
Binary
Shift Right
Binary
Equal
Binary
Not equal
Binary
Greater than or equal
Binary
Greater than
Binary
Less than or equal
Binary
Less than
Binary
Min
Binary
Max
Binary
Neg
Unary
Not
Unary