Files
tfhe-rs/tfhe/Cargo.toml
2025-03-07 11:07:19 +01:00

345 lines
8.9 KiB
TOML

[package]
name = "tfhe"
version = "1.0.0"
edition = "2021"
readme = "../README.md"
keywords = ["fully", "homomorphic", "encryption", "fhe", "cryptography"]
homepage = "https://zama.ai/"
documentation = "https://docs.zama.ai/tfhe-rs"
repository = "https://github.com/zama-ai/tfhe-rs"
license = "BSD-3-Clause-Clear"
description = "TFHE-rs is a fully homomorphic encryption (FHE) library that implements Zama's variant of TFHE."
build = "build.rs"
exclude = [
"/docs/",
"/c_api_tests/",
"/CMakeLists.txt",
"/js_on_wasm_tests/",
"/web_wasm_parallel_tests/",
]
rust-version = "1.84"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dev-dependencies]
rand = { workspace = true }
rand_distr = "0.4.3"
criterion = "0.5.1"
doc-comment = "0.3.3"
serde_json = "1.0.94"
# clap has to be pinned as its minimum supported rust version
# changes often between minor releases, which breaks our CI
clap = { version = "=4.4.4", features = ["derive"] }
# Used in user documentation
fs2 = { version = "0.4.3" }
statrs = "0.18"
# For erf and normality test
libm = "0.2.6"
# Begin regex-engine deps
test-case = "3.1.0"
combine = "4.6.6"
env_logger = "0.11"
log = "0.4.19"
hex = "0.4.3"
# End regex-engine deps
strum = { version = "0.26", features = ["derive"] }
[build-dependencies]
cbindgen = { version = "0.28", optional = true }
[dependencies]
tfhe-csprng = { version = "0.5.0", path = "../tfhe-csprng", features = [
"parallel",
] }
serde = { workspace = true, features = ["default", "derive"] }
rayon = { workspace = true }
bincode = "1.3.3"
tfhe-fft = { version = "0.8.0", path = "../tfhe-fft", features = [
"serde",
"fft128",
] }
tfhe-ntt = { version = "0.5.0", path = "../tfhe-ntt" }
pulp = { workspace = true, features = ["default"] }
tfhe-cuda-backend = { version = "0.8.0", path = "../backends/tfhe-cuda-backend", optional = true }
aligned-vec = { workspace = true, features = ["default", "serde"] }
dyn-stack = { workspace = true, features = ["default"] }
paste = "1.0.7"
fs2 = { version = "0.4.3", optional = true }
# Used for OPRF in shortint
sha3 = { version = "0.10", optional = true }
itertools = { workspace = true }
rand_core = { version = "0.6.4", features = ["std"] }
tfhe-zk-pok = { version = "0.5.0", path = "../tfhe-zk-pok", optional = true }
tfhe-versionable = { version = "0.5.0", path = "../utils/tfhe-versionable" }
# wasm deps
wasm-bindgen = { workspace = true, features = [
"serde-serialize",
], optional = true }
wasm-bindgen-rayon = { version = "1.3.0", optional = true }
js-sys = { version = "0.3", optional = true }
console_error_panic_hook = { version = "0.1.7", optional = true }
serde-wasm-bindgen = { version = "0.6.0", optional = true }
getrandom = { version = "0.2.8", optional = true }
bytemuck = { workspace = true }
[features]
boolean = []
shortint = ["dep:sha3"]
integer = ["shortint"]
strings = ["integer"]
internal-keycache = ["dep:fs2"]
gpu = ["dep:tfhe-cuda-backend"]
zk-pok = ["dep:tfhe-zk-pok"]
# Adds more FheUint/FheInt types to the HL
extended-types = []
pbs-stats = []
noise-asserts = []
# Experimental section
experimental = []
experimental-force_fft_algo_dif4 = []
# End experimental section
__c_api = ["dep:cbindgen"]
# Can be used in some situations to reduce build time with GPU
__force_skip_cbindgen = []
boolean-c-api = ["boolean", "__c_api"]
shortint-c-api = ["shortint", "__c_api"]
high-level-c-api = ["boolean-c-api", "shortint-c-api", "integer"]
__wasm_api = [
"dep:wasm-bindgen",
"dep:js-sys",
"dep:console_error_panic_hook",
"dep:serde-wasm-bindgen",
"dep:getrandom",
"getrandom/js",
]
boolean-client-js-wasm-api = ["boolean", "__wasm_api"]
shortint-client-js-wasm-api = ["shortint", "__wasm_api"]
integer-client-js-wasm-api = ["integer", "shortint-client-js-wasm-api"]
high-level-client-js-wasm-api = [
"boolean-client-js-wasm-api",
"integer-client-js-wasm-api",
]
parallel-wasm-api = ["dep:wasm-bindgen-rayon"]
nightly-avx512 = ["tfhe-fft/nightly", "tfhe-ntt/nightly", "pulp/nightly"]
# Private features
__profiling = []
software-prng = ["tfhe-csprng/software-prng"]
[package.metadata.docs.rs]
# TODO: manage builds for docs.rs based on their documentation https://docs.rs/about
features = [
"boolean",
"shortint",
"integer",
"gpu",
"zk-pok",
"software-prng",
"strings",
]
rustdoc-args = ["--html-in-header", "katex-header.html"]
###########
# #
# Benches #
# #
###########
[[bench]]
name = "ks-bench"
path = "benches/core_crypto/ks_bench.rs"
harness = false
required-features = ["shortint", "internal-keycache"]
[[bench]]
name = "pbs-bench"
path = "benches/core_crypto/pbs_bench.rs"
harness = false
required-features = ["boolean", "shortint", "internal-keycache"]
[[bench]]
name = "ks-pbs-bench"
path = "benches/core_crypto/ks_pbs_bench.rs"
harness = false
required-features = ["shortint", "internal-keycache"]
[[bench]]
name = "dev-bench"
path = "benches/core_crypto/dev_bench.rs"
harness = false
required-features = ["internal-keycache"]
[[bench]]
name = "modulus_switch_noise_reduction"
path = "benches/core_crypto/modulus_switch_noise_reduction.rs"
harness = false
required-features = ["shortint"]
[[bench]]
name = "pbs128-bench"
path = "benches/core_crypto/pbs128_bench.rs"
harness = false
required-features = ["shortint"]
[[bench]]
name = "boolean-bench"
path = "benches/boolean/bench.rs"
harness = false
required-features = ["boolean", "internal-keycache"]
[[bench]]
name = "shortint-bench"
path = "benches/shortint/bench.rs"
harness = false
required-features = ["shortint", "internal-keycache"]
[[bench]]
name = "oprf-shortint-bench"
path = "benches/shortint/oprf.rs"
harness = false
required-features = ["shortint", "internal-keycache"]
[[bench]]
name = "glwe_packing_compression-shortint-bench"
path = "benches/shortint/glwe_packing_compression.rs"
harness = false
required-features = ["shortint", "internal-keycache"]
[[bench]]
name = "glwe_packing_compression-integer-bench"
path = "benches/integer/glwe_packing_compression.rs"
harness = false
required-features = ["integer", "internal-keycache"]
[[bench]]
name = "integer-bench"
path = "benches/integer/bench.rs"
harness = false
required-features = ["integer", "internal-keycache"]
[[bench]]
name = "integer-signed-bench"
path = "benches/integer/signed_bench.rs"
harness = false
required-features = ["integer", "internal-keycache"]
[[bench]]
name = "zk-pke-bench"
path = "benches/integer/zk_pke.rs"
harness = false
required-features = ["integer", "zk-pok", "internal-keycache"]
[[bench]]
name = "hlapi"
path = "benches/high_level_api/bench.rs"
harness = false
required-features = ["integer", "internal-keycache"]
[[bench]]
name = "hlapi-erc20"
path = "benches/high_level_api/erc20.rs"
harness = false
required-features = ["integer", "internal-keycache"]
[[bench]]
name = "keygen"
path = "benches/keygen/bench.rs"
harness = false
required-features = ["shortint", "internal-keycache"]
[[bench]]
name = "utilities"
path = "benches/utilities.rs"
harness = false
required-features = ["boolean", "shortint", "integer", "internal-keycache"]
# Examples used as tools
[[example]]
name = "wasm_benchmarks_parser"
path = "examples/utilities/wasm_benchmarks_parser.rs"
required-features = ["shortint", "internal-keycache"]
[[example]]
name = "generates_test_keys"
path = "examples/utilities/generates_test_keys.rs"
required-features = ["boolean", "shortint", "internal-keycache"]
[[example]]
name = "boolean_key_sizes"
path = "examples/utilities/boolean_key_sizes.rs"
required-features = ["boolean", "internal-keycache"]
[[example]]
name = "shortint_key_sizes"
path = "examples/utilities/shortint_key_sizes.rs"
required-features = ["shortint", "internal-keycache"]
[[example]]
name = "hlapi_compact_pk_ct_sizes"
path = "examples/utilities/hlapi_compact_pk_ct_sizes.rs"
required-features = ["integer", "internal-keycache"]
[[example]]
name = "micro_bench_and"
path = "examples/utilities/micro_bench_and.rs"
required-features = ["boolean"]
[[example]]
name = "write_params_to_file"
path = "examples/utilities/params_to_file.rs"
required-features = ["boolean", "shortint", "internal-keycache"]
[[example]]
name = "print_doc_bench_parameters"
path = "examples/utilities/print_doc_bench_parameters.rs"
required-features = ["shortint", "internal-keycache"]
# Real use-case examples
[[example]]
name = "dark_market"
required-features = ["integer", "internal-keycache"]
[[example]]
name = "regex_engine"
required-features = ["integer"]
[[example]]
name = "sha256_bool"
required-features = ["boolean"]
[[example]]
name = "sha256"
required-features = ["integer"]
[[example]]
name = "pbs_count"
required-features = ["integer", "pbs-stats"]
[[example]]
name = "dist_tuniform"
required-features = ["integer", "internal-keycache"]
[lib]
crate-type = ["lib", "staticlib", "cdylib"]
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(tarpaulin)',
'cfg(dylint_lib, values(any()))',
# This is a bug/unwanted behavior from wasm_bindgen macro, for now warn instead of erroring
'cfg(wasm_bindgen_unstable_test_coverage)',
] }