poulpyFully homomorphic encryption
GitHub Get started
Menu

Compute with encrypted integers.

Use Binary FHE for Boolean gates, lookup tables, and word-level arithmetic on encrypted unsigned integers.

For developers starting integer computation · Source guide · 2394fa5

Run the integer example

First complete the source and toolchain setup. From the Poulpy repository directory, run:

cargo run --locked --release -p poulpy-cpu-ref --features enable-core --example bdd_arithmetic

The bdd_arithmetic.rs example encrypts integers, performs arithmetic and selection, then decrypts and compares each result with the corresponding ordinary computation. Its Result: lines print the decrypted and expected values side by side.

This example uses the portable backend. It may take longer than the small CKKS quickstart because it performs bootstrapping as part of the computation.

Read the result

The first computation evaluates (a + b) XOR a with a = 255 and b = 30. Its decrypted result should match the expected value:

Result: 482 == 482

Later comparisons use randomly generated inputs, so their values vary between runs. Each line should show matching values. The source is the reference for supported widths and signedness.

Before changing a circuit, check its overflow and comparison semantics and the evaluation-key requirements. These are discrete computations, but valid parameters and noise bounds still determine correctness. The concept guide explains the roles of bootstrapping and evaluation keys.

Follow the building blocks

The poulpy-bin-fhe crate builds integer operations on three layers:

  1. Blind rotation evaluates a programmable lookup table on encrypted input.
  2. Circuit bootstrapping prepares encrypted bits for use as selectors.
  3. BDD arithmetic combines these selectors to evaluate integer circuits.

See the codebase overview for how these layers fit together, or open the poulpy-bin-fhe API reference for types and operations.

Try it in a browser

Squid’s interactive demo lets you explore encrypted integer arithmetic through a wrapper around Poulpy. Its source repository includes Rust, WebAssembly, and Node bindings.

Go further