Environment variables and the parameter cache¶
Environment variables¶
The library reads these when it is imported (set them before
import pyfe4ai or in the shell); the functions in the last column change
the same settings at runtime.
Variable |
Effect |
At runtime |
|---|---|---|
|
|
|
|
threads one native call may use over the chunks of a tensor (default
1, clamped to |
|
|
the library-wide Gaussian sampler, |
|
|
the parameter cache directory (below); a |
|
|
set at installation: |
– |
pyfe4ai.backend_info() reports the values in effect. Set the
process-wide values once, before threads start (Threads, Processes and Copies).
These only concern a source checkout:
Variable |
Effect |
|---|---|
|
the pairing group of the pairing-scheme tests (default BLS12-381),
e.g. |
|
the path of the |
|
where the tests that configure logging write their log files
(default: a |
|
cargo’s build directory, also for |
The parameter cache¶
Key generators keep the parameters they generate – discrete-log groups,
lattice dimensions and moduli, the seeds of public matrices – in a
parameter cache and load them again for the same configuration, which saves
the expensive steps of setup().
Where.
<cache>/authority/<scheme type>/param.json(RNS moduli inparam-rns.json), where<cache>is thecache_direntry of the key generator’s config, elsePYFE4AI_CACHE_DIR, else the per-user cache directory (default_cache_dir()):~/Library/Caches/pyfe4aion macOS,$XDG_CACHE_HOME/pyfe4aior~/.cache/pyfe4aion Linux,%LOCALAPPDATA%\pyfe4ai\Cacheon Windows. The DDH crypto objects keep their discrete-log tables under<cache>/crypto/. Version 0.3.0 used./config/of the working directory: move./config/authorityto the new place, or setPYFE4AI_CACHE_DIR=./config, to keep its records.One record per scheme type. A key generator whose configuration does not match the cached record (other dimensions, bounds or profile, or a record of an earlier version) generates new parameters and seeds, replaces the record and warns:
FEWarning: the parameter record .../authority/SIFE/param.json does not match this configuration (for example a record of an earlier version): regenerated with new parameters and seeds; keys, public parameters and ciphertexts made with the old record no longer match
Expect it when several configurations of one scheme, or several examples, run one after another. Keys and ciphertexts already made keep working with the public parameters they were made with; setting up the earlier configuration again draws new parameters. Give each configuration its own
cache_dirto keep both. An unreadable record is regenerated the same way; records are written atomically.Checks. A cached record is used only if it matches the configuration: discrete-log groups are checked for primality, size, safe-prime structure and generator order, DCR moduli for size and small factors (their factors are never stored), and the lattice parameters are re-derived or expanded from stored seeds; under
standardthe lattice moduli are checked against the 128-bit tables again.Trust. No check can tell whether someone knows the factors of a DCR modulus. Under
standardthe Paillier moduli are generated for every key generator and never stored; undertoya planted modulus would be used. Use a cache directory that nobody else can write to. Processes that share a directory share its records.