Python wrapper for labeled and unlabeled asynchronous private set intersection (APSI).
Project description
PyAPSI
Python wrapper for labeled and unlabeled asynchronous private set intersection (APSI).
Setup
For manylinux_2_31_x86_64
compatible platforms you can install PyAPSI
from
PyPi with
pip install apsi
You can check the system library versions that are required to be
manylinux_2_31_x86_64
compatible in the
auditwheel policy.
In case you feel like contributing a build setup for Windows and OSX compatible wheels or extend the "From Source" section below, I would be happy to review your pull request.
Example
Example usage of the labeled APSI server and client. The unlabeled variant can be used analogous to this.
from apsi import LabeledServer, LabeledClient
apsi_params = """
{
"table_params": {
"hash_func_count": 3,
"table_size": 512,
"max_items_per_bin": 92
},
"item_params": {"felts_per_item": 8},
"query_params": {
"ps_low_degree": 0,
"query_powers": [1, 3, 4, 5, 8, 14, 20, 26, 32, 38, 41, 42, 43, 45, 46]
},
"seal_params": {
"plain_modulus": 40961,
"poly_modulus_degree": 4096,
"coeff_modulus_bits": [40, 32, 32]
}
}
"""
server = LabeledServer()
server.init_db(apsi_params, max_label_length=10)
server.add_items([("item", "1234567890"), ("abc", "123"), ("other", "my label")])
client = LabeledClient(apsi_params)
oprf_request = client.oprf_request(["item", "abc"])
oprf_response = server.handle_oprf_request(oprf_request)
query = client.build_query(oprf_response)
response = server.handle_query(query)
result = client.extract_result(response)
assert result == {"item": "1234567890", "abc": "123"}
To control multi threading and logging in APSI
see
apsi.utils
.
Building & Testing
Docker
Before you start, make sure that Taskfile, Docker and Poetry are installed.
You can then run a full build with tests that will generate a wheel file in dist/
as
follows:
task wheel PYTHON_VERSION=3.10.4
Note: Only Python 3.8, 3.9, 3.10, and their patch versions for which official Python Docker images exist are supported.
From Source
Please have a look at the files inside
docker/
for the required vcpkg
setup and apsi
AVX2 patch, in case you'd like to build from source in a custom
environment.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file apsi-0.1.2-cp310-cp310-manylinux_2_31_x86_64.whl
.
File metadata
- Download URL: apsi-0.1.2-cp310-cp310-manylinux_2_31_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.10, manylinux: glibc 2.31+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d00fe0c2dc036a9a4164965f5eed7cc5c1bc742c5e7b520bf7a46b85c439393d |
|
MD5 | c01d9d32296821a8110986b54c6aa362 |
|
BLAKE2b-256 | 13cf1861f5cec2b3443ae51a58dce30aa80b3b38ef15444e8f187490b30467ce |
File details
Details for the file apsi-0.1.2-cp39-cp39-manylinux_2_31_x86_64.whl
.
File metadata
- Download URL: apsi-0.1.2-cp39-cp39-manylinux_2_31_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.9, manylinux: glibc 2.31+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 102399a635858da1dcf74fba2cbd07556d5f0ddb4ecae3f743f106c8027f42bb |
|
MD5 | 8367938ead55135bbf03165c8a4bbac1 |
|
BLAKE2b-256 | e026ad270b5c06d6235eb76f3ca78542bfb2d380274fd3f41f44bbc8fdba7497 |
File details
Details for the file apsi-0.1.2-cp38-cp38-manylinux_2_31_x86_64.whl
.
File metadata
- Download URL: apsi-0.1.2-cp38-cp38-manylinux_2_31_x86_64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.8, manylinux: glibc 2.31+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d825f2f7888c9b469eb03c8c2a703e7cbd3c22ebc36bd494c9b753447f15718 |
|
MD5 | e90a5faa8365b0c50b7da9b83e625017 |
|
BLAKE2b-256 | 33ae3db3aca75e150a8d4b7565b2da9660e6e5165a0fb1e974b7d0f1d5c11c39 |