TFHE-rs
WebsiteLibrariesProduct & ServicesDevelopersSupport
1.0
1.0
  • Welcome to TFHE-rs
  • Get Started
    • What is TFHE-rs?
    • Installation
    • Quick start
    • Benchmarks
      • CPU Benchmarks
        • Integer
        • Programmable bootstrapping
      • GPU Benchmarks
        • Integer
        • Programmable bootstrapping
      • Zero-knowledge proof benchmarks
    • Security and cryptography
  • FHE Computation
    • Types
      • Integer
      • Strings
      • Array
    • Operations
      • Arithmetic operations
      • Bitwise operations
      • Comparison operations
      • Min/Max operations
      • Ternary conditional operations
      • Casting operations
      • Boolean Operations
      • String Operations
    • Core workflow
      • Configuration and key generation
      • Server key
      • Encryption
      • Decryption
      • Parameters
    • Data handling
      • Compressing ciphertexts/keys
      • Serialization/deserialization
      • Data versioning
    • Advanced features
      • Encrypted pseudo random values
      • Overflow detection
      • Public key encryption
      • Trivial ciphertexts
      • Zero-knowledge proofs
      • Multi-threading with Rayon crate
    • Tooling
      • PBS statistics
      • Generic trait bounds
      • Debugging
  • Configuration
    • Advanced Rust setup
    • GPU acceleration
    • Parallelized PBS
  • Integration
    • JS on WASM API
    • High-level API in C
  • Tutorials
    • Homomorphic parity bit
    • Homomorphic case changing on Ascii string
    • SHA256 with Boolean API
    • All tutorials
  • References
    • API references
    • Fine-grained APIs
      • Quick start
      • Boolean
        • Operations
        • Cryptographic parameters
        • Serialization/Deserialization
      • Shortint
        • Operations
        • Cryptographic parameters
        • Serialization/Deserialization
      • Integer
        • Operations
        • Cryptographic parameters
        • Serialization/Deserialization
    • Core crypto API
      • Quick start
      • Tutorial
  • Explanations
    • TFHE deep dive
  • Developers
    • Contributing
    • Release note
    • Feature request
    • Bug report
Powered by GitBook

Libraries

  • TFHE-rs
  • Concrete
  • Concrete ML
  • fhEVM

Developers

  • Blog
  • Documentation
  • Github
  • FHE resources

Company

  • About
  • Introduction to FHE
  • Media
  • Careers
On this page

Was this helpful?

Export as PDF
  1. FHE Computation
  2. Operations

String Operations

This document details the string operations supported by TFHE-rs.

clear name
fhe name
first input type
second input type
third input type

eq

FheAsciiString

FheAsciiString or ClearString

ne

FheAsciiString

FheAsciiString or ClearString

le

FheAsciiString

FheAsciiString or ClearString

ge

FheAsciiString

FheAsciiString or ClearString

lt

FheAsciiString

FheAsciiString or ClearString

gt

FheAsciiString

FheAsciiString or ClearString

len

FheAsciiString

is_empty

FheAsciiString

eq_ignore_case

FheAsciiString

FheAsciiString or ClearString

to_lowercase

FheAsciiString

to_uppercase

FheAsciiString

contains

FheAsciiString

FheAsciiString or ClearString

ends_with

FheAsciiString

FheAsciiString or ClearString

starts_with

FheAsciiString

FheAsciiString or ClearString

find

FheAsciiString

FheAsciiString or ClearString

rfind

FheAsciiString

FheAsciiString or ClearString

strip_prefix

FheAsciiString

FheAsciiString or ClearString

strip_suffix

FheAsciiString

FheAsci---iString or ClearString

concat

FheAsciiString

FheAsciiString

repeat

FheAsciiString

u16 or u32 or i32 or usize or (FheUint16, u16)

trim_end

FheAsciiString

trim_start

FheAsciiString

trim

FheAsciiString

replace

FheAsciiString

FheAsciiString

replacen

FheAsciiString

FheAsciiString or ClearString

u16 or u32 or i32 or usize or (FheUint16, u16)

The following example shows how to perform string operations:

use tfhe::prelude::*;
use tfhe::{
    generate_keys, set_server_key, ConfigBuilder, FheAsciiString, FheStringLen,
};
    
fn main() -> Result<(), Box<dyn std::error::Error>> {
    
    let config = ConfigBuilder::default().build();
    let (client_key, server_key) = generate_keys(config);
    set_server_key(server_key);
    
    let string1 = FheAsciiString::try_encrypt("tfhe-RS", &client_key).unwrap();
    let string2 = FheAsciiString::try_encrypt("TFHE-rs", &client_key).unwrap();
    let is_eq = string1.eq_ignore_case(&string2);

    assert!(is_eq.decrypt(&client_key));

    Ok(())
}
PreviousBoolean OperationsNextCore workflow

Last updated 2 months ago

Was this helpful?

eq
ne
le
ge
lt
gt
len
is_empty
eq_ignore_ascii_case
to_lowercase
to_uppercase
contains
ends_with
starts_with
find
rfind
strip_prefix
strip_suffix
concat
repeat
trim_end
trim_start
trim
replace
replacen