Build outside the library checkout.
Download a complete Cargo project, compute on encrypted vectors, and verify the result.
For application developers · Source guide · 2394fa5
Download and run
Install Git, rustup, and the native build tools from Quickstart. Download the complete example project, then extract it:
tar -xzf poulpy-app.tar.gz
cd poulpy-app
cargo run --locked --release --bin poulpy-website-example
The archive contains Cargo.toml, Cargo.lock, rust-toolchain.toml, shared setup code, and both executable examples. Its four Poulpy dependencies point to the exact guide revision; Cargo fetches that snapshot automatically. Rustup reads the pinned nightly from this directory.
The manifest, main program, and shared setup are also available individually.
What the program checks
The program computes z = (a + b) × b on 512 packed complex slots. It encodes real inputs with zero imaginary parts, encrypts both vectors, adds, multiplies with a relinearization key, then decrypts and decodes.
fresh ct: log_delta=45 log_budget=111
after mul: log_delta=45 log_budget=66
max |want - have| = ...
ok: z = (a + b) * b verified on 512 slots
It checks every real output against the cleartext calculation with absolute error below 1e-9, and checks the imaginary residual against the same tolerance. The exact error is diagnostic output, not a precision guarantee for other workloads.
Unlike the upstream quickstart’s additional division by 32, this standalone program verifies the expression shown here directly.
Read the files in order
| File | Responsibility |
|---|---|
src/lib.rs | Shared backend, layout parameters, and key-layout helpers |
src/main.rs | Setup → encode/encrypt → evaluate → decrypt/check |
src/bin/client_evaluator.rs | Separate command-line client and evaluator with serialized objects |
Cargo.lock | Reproducible dependency resolution |
The constants and fixed seeds in main.rs are for a reproducible learning example, not an application security profile. The parameter worksheet explains the configuration and the analysis needed before changing its purpose.
Make one change
Change the generated input vectors in main.rs, keeping their magnitudes bounded, and rerun the program. Keep the cleartext reference calculation and tolerance check. When changing the computation itself, inspect the resulting scale and budget and update the required keys.
Then follow the client/evaluator example to see what crosses a process boundary. Use Troubleshooting if the toolchain, backend, or metadata rejects a configuration.