This document explains the FheAsciiString type for handling encrypted strings in TFHE-rs.
TFHE-rs has supports for ASCII strings with the type FheAsciiString. You can enable this feature using the flag: --features=strings
Strings are not yet compatible with CompactCiphertextList
and CompressedCiphertextList
A variety of common operations are supported for FheAsciiString
. These include:
Comparisons: eq
, ne
, lt
, le
, gt
, ge
, eq_ignore_case
Case conversion: to_lowercase
/ to_uppercase
String checks: starts_with
/ ends_with
/ contains
Trimming: trim_start
/ trim_end
/ trim
Prefix/suffix operations: strip_prefix
/ strip_suffix
Search: find
/ rfind
When encrypting strings, you can add padding to hide the actual length of strings. The null character (b'\0') is used as the padding. Here is an example:
This document describes the array types provided by the High-level API.
This new encrypted types allow you to easily perform array and tensor operations on encrypted data, taking care of the iteration and shape logic for you.
It also implements efficient algorithms in some cases, like summing elements of an array.
The following example shows a complete workflow of working with encrypted arrays, including:
Generating keys
Encrypting arrays of integers
Performing operations such as:
slicing arrays
computing on a sub array, adding encrypted data to it
computing on a sub array, adding clear data to it
Decrypting the result, getting back a Rust Vec
of decrypted values
This document describes the main integer types of encrypted data in TFHE-rs and explains how to specify bit sizes for encryption.
TFHE-rs supports two main types of encrypted data:
FheUint
: homomorphic equivalent of Rust unsigned integers u8, u16, ...
FheInt
: homomorphic equivalent of Rust signed integers i8, i16, ...
TFHE-rs uses integers to encrypt all messages which are larger than 4 bits.
Similar to Rust integers, you need to specify the bit size of data when declaring a variable: