vfhe

PyPI Python versions CI OpenSSF Scorecard OpenSSF Best Practices License

The vfhe library: a library for Zero-Knowledge Proofs, (verifiable) Fully Homomorphic Encryption, and related techniques.

❗ Warning: This is a pre-release version of the library and is subject to breaking changes. ❗

Using vfhe starts at Installing and continues in USAGE.md; changing it starts at DEVELOPMENT.md. The documentation site, API reference included, is https://vfhe.github.io/vfhe/.


Installing

Supported platforms: Linux and macOS (POSIX only), on x86_64 and arm64.

pip install vfhe

vfhe ships one engine per instruction-set level it has kernels for: portable (any CPU), avx512ifma (x86_64 with AVX-512 IFMA), and neon (arm64). An install carries every engine its architecture can run and picks the best one at import, so it moves freely between machines of that architecture. Wheels cover Linux x86_64/arm64 and macOS arm64; elsewhere pip builds the same install from the sdist, which needs a C compiler (clang/gcc) and bundles the BLAKE3 sources, so no submodules are required.

Choosing the compiler (sdist builds only). The build uses your interpreter’s compiler by default (no configuration needed). To pick a specific one (e.g. with several installed), set the standard CC environment variable:

CC=gcc-14 pip install --no-binary vfhe vfhe

What did I get? python -m vfhe.util.info prints the whole environment a bug report needs:

{
  "version": "0.0.3",
  "engine": "neon",
  "engine_file": "/…/site-packages/_vfhe_native_neon.so",
  "runs": {
    "avx512ifma": false,
    "neon": true,
    "portable": true
  },
  "python": "3.14.5 CPython",
  "platform": "macOS-26.6.2-arm64-arm-64bit-Mach-O"
}

Pinning the engine. VFHE_ENGINE=<name> selects that engine at import without asking the CPU, so an emulator can run one the host lacks. An unknown or uninstalled name is refused.

Verifying a release

Each release artifact — sdist and wheels — is signed with Sigstore build provenance. To verify one came from this repository’s release workflow (needs the GitHub CLI):

pip download --no-deps --no-binary :all: vfhe==<version>   # fetch the sdist
gh attestation verify vfhe-<version>.tar.gz --repo vfhe/vfhe

Expected output confirms the attestation and shows the signer identity: the .github/workflows/release-pypi.yml workflow of vfhe/vfhe, issued by GitHub Actions’ OIDC (https://token.actions.githubusercontent.com). A mismatch, or no attestation, means the artifact is not a genuine release. PyPI also records these attestations at https://pypi.org/project/vfhe/#files.


Usage

A walkthrough of encrypted computation with CKKS is in USAGE.md; test/smoke/ckks.py is its runnable form.


Modules

Each module is a self-contained folder under modules/. A module is Python-facing (ships a python/ package + a cdef exposing its C to Python) or internal C-only (contributes compiled kernels used by other modules, no Python symbols). A Python-facing module’s public API is its __init__ re-exports.

Module

Kind

What it provides

arith

Python-facing

RNS polynomial arithmetic over Z_q[X]/(X^N+1): incomplete NTTs, complex FFTs, general multiprecision, basic number theory procedures, and multilinear extensions

util

Python-facing

The native handle (ffi/lib), the engine picker and the pure-Python host probes (vfhe.util._cpu), vfhe.util.info, custom kernel builds (vfhe.util.kernels), and the C substrate (aligned allocation, the thread limit and parallel loop)

crypto

Python-facing

Basic primitives: the library’s randomness (BLAKE3-seeded PRNG, AES-CTR RNG, Box-Muller sampling, a seeded transcript sampler) and BLAKE3 Merkle trees

mlwe

Python-facing

LWE / Module-LWE and MGSW: key generation, encryption, key-switching, arithmetic, and ring morphisms

fhe

Python-facing

Schemes on top of mlwe: CKKS (encode/encrypt/rescale/rotate/multiply), CGGI16 functional bootstrap, GP25 sparse-amortized bootstrap

piop

Python-facing

Sketch of IOP prover/verifier framework (currently under development)

polycom

Python-facing

Basefold polynomial commitments over a foldable Reed-Solomon code (currently under development)

circuit

Python-facing

Arithmetic circuits (wire format in proto/) and their polynomial export to arith (currently under development)

vfhe

placeholder

the top-level assembly that will tie the modules together

Still to come, each its own module when it has code: a circuit compiler frontend lowering programs to GKR circuits, and the SNARK layer over the PIOP and its commitments.

Development

The module map is ARCHITECTURE.md. The development guide — repository layout, build system, testing, coverage, and CI — is DEVELOPMENT.md. Contribution expectations are in CONTRIBUTING.md.


Authors

See AUTHORS.md; how the project is run is in GOVERNANCE.md.

Maintainers can be reached at maintainers@vfhe.ai.


Citation

If you use vfhe in academic work, please cite the software using CITATION.cff (GitHub renders a “Cite this repository” button from it) and the archived release DOI where relevant. (When a paper is published, we’ll add it as the preferred citation.) In BibTeX form:

@software{The_vfhe_library,
  author = {Cascudo, Ignacio and Costache, Anamaria and Cozzo, Daniele and
            Dubois, Adrien and Fiore, Dario and Guimarães, Antonio and
            Köstler, Robin and Osadnik, Michał and Roșu, Alin-Petru and
            Soria-Vazquez, Eduardo},
  license = {Apache-2.0},
  title = {{The vfhe library}},
  url = {https://github.com/vfhe/vfhe}
}

Acknowledgements

This work is supported by: Grants JDC2024-055789-I and Excelencia María de Maeztu (CEX2024-001471-M) funded by MICIU/AEI/10.13039/501100011033 and ESF+; the PICOCRYPT project that has received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (Grant agreement No. 101001283); the ERC Proof of Concept grant VERIFHE (GA: 101287502). Funded by the European Union. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the European Research Council. Neither the European Union nor the granting authority can be held responsible for them.