Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

nilql

Library for working with encrypted data within nilDB queries and replies.

PyPI version and link. Read the Docs documentation status. GitHub Actions status. Coveralls test coverage summary.

Description and Purpose

This library provides cryptographic operations that are compatible with nilDB nodes and clusters, allowing developers to leverage certain privacy-enhancing technologies (PETs) when storing, operating upon, and retrieving data while working with nilDB. The table below summarizes the functionalities that nilQL makes available.

Cluster

Operation

Implementation Details

Supported Types

single
node

store

XSalsa20 stream cipher
Poly1305 MAC
32-bit signed integer
UTF-8 string (<4097 bytes)

match

deterministic salted hashing
via SHA-512
32-bit signed integer
UTF-8 string (<4097 bytes)

sum

non-deterministic Paillier
with 2048-bit primes

32-bit signed integer

multiple
nodes

store

XOR-based secret sharing

32-bit signed integer
UTF-8 string (<4097 bytes)

match

deterministic salted hashing
via SHA-512
32-bit signed integer
UTF-8 string (<4097 bytes)

sum

additive secret sharing (no threshold)
Shamir secret sharing (with threshold)
(prime modulus 2^32 + 15 for both)

32-bit signed integer

Installation and Usage

The library can be imported in the usual ways:

import nilql
from nilql import *

Example

An example workflow that demonstrates use of the library is presented below:

import nilql
cluster = {'nodes': [{}, {}, {}]}
secret_key = nilql.SecretKey.generate(cluster, {'store': True})
plaintext = 123
ciphertext = nilql.encrypt(secret_key, plaintext)
decrypted = nilql.decrypt(secret_key, ciphertext)
assert(plaintext == decrypted)

Development

All installation and development dependencies are fully specified in pyproject.toml. The project.optional-dependencies object is used to specify optional requirements for various development tasks. This makes it possible to specify additional options (such as docs, lint, and so on) when performing installation using pip:

python -m pip install ".[docs,lint]"

Documentation

The documentation can be generated automatically from the source files using Sphinx:

python -m pip install ".[docs]"
cd docs
sphinx-apidoc -f -E --templatedir=_templates -o _source .. && make html

Testing and Conventions

All unit tests are executed and their coverage is measured when using pytest (see the pyproject.toml file for configuration details):

python -m pip install ".[test]"
python -m pytest

The subset of the unit tests included in the module itself and can be executed using doctest:

python src/nilql/nilql.py -v

Style conventions are enforced using Pylint:

python -m pip install ".[lint]"
python -m pylint src/nilql test/test_nilql.py

Contributions

In order to contribute to the source code, open an issue or submit a pull request on the GitHub page for this library.

Versioning

The version number format for this library and the changes to the library associated with version number increments conform with Semantic Versioning 2.0.0.

Publishing

This library can be published as a package on PyPI via the GitHub Actions workflow found in .github/workflows/build-publish-sign-release.yml that follows the recommendations found in the Python Packaging User Guide.

Ensure that any links in this README document to the Read the Docs documentation of this package (or its dependencies) have appropriate version numbers. Also ensure that the Read the Docs project for this library has an automation rule that activates and sets as the default all tagged versions.

Metadata

Release files for nilql 0.0.0a13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nilql 0.0.0a13
File Size Uploaded Provenance Actions
nilql-0.0.0a13.tar.gz 19.3 kB With provenance Details for nilql-0.0.0a13.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nilql 0.0.0a13
File Interpreter ABI Platform Actions
nilql-0.0.0a13-py3-none-any.whl Python 3 none any Details for nilql-0.0.0a13-py3-none-any.whl

Total release size: 33.2 kB

Release files / nilql-0.0.0a13.tar.gz

Download URL nilql-0.0.0a13.tar.gz
Size 19.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cb0011ff704001c83209a3185d89a8b0a16cec8089551469b5c19d52659dd359
BLAKE2b-256 checksum
How to use checksums
3f6759f4b6ceac7c7719e4830a8f017d7d289b48da20dc2791f55ba3d2968bbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 12, 2025.

Transparency log

Release files / nilql-0.0.0a13-py3-none-any.whl

Download URL nilql-0.0.0a13-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f369a0530340ef890d9916d748147c0c54eb8a1b9f79dd6f3124c546ec39d9f3
BLAKE2b-256 checksum
How to use checksums
13b08b8641ddd3d40aaee0fccb3a167d7ee31f0021c93c93c0a19ddc50942d9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 12, 2025.

Transparency log

Security for nilql 0.0.0a13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nilql-0.0.0a13.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 12, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page