Distributed Laplace Perturbation Algorithm¶
Summary¶
Client and server applications providing Distributed Laplace Perturbation Algorithm (DLPA).
The DLPA has been introduced by Vibhor Rastogi and Suman Nath in “Differentially Private Aggregation of Distributed Time-Series with Transformation and Encryption,” published in SIGMOD 2010.
Client¶
This package has client class dlpa.DLPAClient
. To create an instance, the constructor takes two arguments:
- host: Address of a DLPA server,
- port: Port number of the DLPA server.
Although the client class implements several protocols defined in DLPA, get_key
and encrypt_noisy_sum
are the only method users might have interest.
The get_key
requests a client key to the server. It takes one argument, client ID, and returns a client key object.
The other method encrypt_noisy_sum
runs the Entryp-Noisy-Sum protocol, which is the key protocol of DLPA. It takes the following four arguments:
- ck: Client key.
- client_id: Client ID.
- value: Scalar or vector to be sent to the server by Encrypt-Sum protocol.
- epsilon: Parameter to generate Laplace noises.
and returns a time slot when the request is attached.
Server¶
dlpa-server
command runs a server application of DLPA. The following is the usage of this command:
usage: dlpa-server [-h] --port PORT --clients NCLIENT
[--max-workers MAX_WORKERS] [--key-length M_LENGTH]
[--time-span SPAN]
optional arguments:
-h, --help show this help message and exit
--port PORT Listening port number.
--clients NCLIENT The number of clients.
--max-workers MAX_WORKERS
The maximum number of workers (default: 10).
--key-length M_LENGTH
Bit length of the secret key (default: 2048).
--time-span SPAN Second of one time slot.
Note that the port number and the number of clients are necessary arguments.
You can also starts a server from another python script by using dlpa.server
function. The function takes the following keyword arguments:
- port: Port number the created server listen.
- max_workers: The maximum number of workers.
- nclient: The number of clients connecting this server.
- m_length: Bit length of the secret key.
and returns a server object, which has a method stop(t)
to stop the server within the given time t
. Callers are responsible for calling the method to close the server.
Installation¶
$ pip install --upgrade psi-dlpa
Additionaly, if you install gmpy2, computation time will be reduced. To install gmpy2 in mac, you also need to install mpc, mpfr, and libmp. Those three packages are available in Homebrew.