百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
T

tfhe-rs

> 编程语言
开源

TFHE-rs: 一个纯 Rust 实现的 TFHE 方案,用于在加密数据上进行布尔和整数算术。

1.6K stars0 点赞1 次浏览
访问官网GitHub

工具介绍

TFHE-rs: 一个纯 Rust 实现的 TFHE 方案,用于在加密数据上进行布尔和整数算术。


Read Handbook | Documentation | Community support | FHE resources by Zama

About

What is TFHE-rs

TFHE-rs is a pure Rust implementation of TFHE for boolean and integer arithmetics over encrypted data.

It includes:

  • a Rust API
  • a C API
  • and a client-side WASM API

TFHE-rs is designed for developers and researchers who want full control over what they can do with TFHE, while not having to worry about the low-level implementation. The goal is to have a stable, simple, high-performance, and production-ready library for all the advanced features of TFHE.

Main features

  • Low-level cryptographic library that implements Zama’s variant of TFHE, including programmable bootstrapping
  • Implementation of the original TFHE boolean API that can be used as a drop-in replacement for other TFHE libraries
  • Short integer API that enables exact, unbounded FHE integer arithmetics with up to 8 bits of message space
  • Size-efficient public key encryption
  • Ciphertext and server key compression for efficient data transfer
  • Full Rust API, C bindings to the Rust High-Level API, and client-side JavaScript API using WASM.

Learn more about TFHE-rs features in the documentation.

Table of Contents

  • Getting started
    • Cargo.toml configuration
    • A simple example
  • Resources
    • TFHE deep dive
    • Tutorials
    • Documentation
  • Working with TFHE-rs
    • Disclaimers
    • Citations
    • Contributing
    • License
  • Support



Getting started

[!Important] TFHE-rs released its first stable version v1.0.0 in February 2025, stabilizing the high-level API for the x86 CPU backend.

Cargo.toml configuration

To use the latest version of TFHE-rs in your project, you first need to add it as a dependency in your Cargo.toml:

toml
tfhe = { version = "*", features = ["boolean", "shortint", "integer"] }

[!Note] Note: You need Rust version 1.91.1 or newer to compile TFHE-rs. You can check your version with rustc --version.

[!Note] Note: AArch64-based machines are not supported for Windows as it's currently missing an entropy source to be able to seed the CSPRNGs used in TFHE-rs.

↑ Back to top

A simple example

Here is a full example:

…

To run this code, use the following command:

cargo run --release

[!Note] Note that when running code that uses TFHE-rs, it is highly recommended to run in release mode with cargo's --release flag to have the best performance possible.

[!Tip] On Linux, enabling transparent huge pages gives a noticeable additional speedup when using many threads. See System tuning for details.

Find an example with more explanations in this part of the documentation

↑ Back to top

Resources

TFHE-rs Handbook

A document containing scientific and technical details about algorithms implemented into the library is available here: TFHE-rs: A (Practical) Handbook.

TFHE deep dive

  • TFHE Deep Dive - Part I - Ciphertext types
  • TFHE Deep Dive - Part II - Encodings and linear leveled operations
  • TFHE Deep Dive - Part III - Key switching and leveled multiplications
  • TFHE Deep Dive - Part IV - Programmable Bootstrapping



Tutorials

  • Video tutorial: Implement signed integers using TFHE-rs
  • Homomorphic parity bit
  • Homomorphic case changing on Ascii string
  • Boolean SHA256 with TFHE-rs
  • Dark market with TFHE-rs
  • Regular expression engine with TFHE-rs

Explore more useful resources in TFHE-rs tutorials and Awesome Zama repo

Documentation

Full, comprehensive documentation is available here: https://docs.zama.org/tfhe-rs.

↑ Back to top

Working with TFHE-rs

Disclaimers

Security estimation

Security estimations are done using the Lattice Estimator with red_cost_model = reduction.RC.BDGL16.

When a new update is published in the Lattice Estimator, we update parameters accordingly.

Security model

By default, the parameter sets used in the High-Level API have a failure probability $\le 2^{-128}$ to securely work in the IND-CPA^D model using the algorithmic techniques provided in our code base [1]. If you want to work within the IND-CPA security model, which is less strict than the IND-CPA-D model, the parameter sets can easily be changed and would have slightly better performance. More details can be found in the TFHE-rs documentation.

[1] Bernard, Olivier, et al. "Drifting Towards Better Error Probabilities in Fully Homomorphic Encryption Schemes". https://eprint.iacr.org/2024/1718.pdf

[2] Li, Baiyu, et al. "Securing approximate homomorphic encryption using differential privacy." Annual International Cryptology Conference. Cham: Springer Nature Switzerland, 2022. https://eprint.iacr.org/2022/816.pdf

Side-channel attacks

Mitigation for side-channel attacks has not yet been implemented in TFHE-rs, and will be released in upcoming versions.

Citations

To cite TFHE-rs in academic papers, please use the following entry:

@Misc{TFHE-rs,
  title={{TFHE-rs: A Pure Rust Implementation of the TFHE Scheme for Boolean and Integer Arithmetics Over Encrypted Data}},
  author={Zama},
  year={2022},
  note={\\url{https://github.com/zama-ai/tfhe-rs}},
}

Contributing

This repository uses an issue-first contribution workflow. Read this for more details.

License

This software is distributed under the BSD-3-Clause-Clear license. Read this for more details.

FAQ

Is Zama’s technology free to use?

Zama’s libraries are free to use under the BSD 3-Clause Clear license only for development, research, prototyping, and experimentation purposes. However, for any commercial use of Zama's open source code, companies must purchase Zama’s commercial patent license.

Everything we do is open source and we are very transparent on what it means for our users, you can read more about how we monetize our open source products at Zama in this blogpost.

What do I need to do if I want to use Zama’s technology for commercial purposes?

To commercially use Zama’s technology you need to be granted Zama’s patent license. Please contact us [email protected] for more information.

Do you file IP on your technology?

Yes, all Zama’s technologies are patented.

Can you customize a solution for my specific use case?

We are open to collaborating and advancing the FHE space with our partners. If you have specific needs, please email us at [email protected].

↑ Back to top

Support

If you find this project helpful or interesting, please consider giving it a star on GitHub! Your support helps to grow the community and motivates further development.

↑ Back to top

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustcryptographyhomomorphic-encryptionrusttfhe

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言