Skip to main content

zanon

A module to anonymize data streams with zero-delay called z-anonymity.

When instantiating the zanon object, the constructor receives a value in seconds for Delta_t, the desired probability of reaching k-anonymity expressed with a value between 0 and 1 (pk) and a value for k.

The anonymize() method accepts a tuple with 3 arguments (t,u,a) , meaning that at time t a user u exposes an attribute a. Also a tuple of kind (t,u, latitude, longitude) is handled (in that case you need the pyproj module).

If the tuple exposes an attribute that has not been exposed by at least other z - 1 users in the past Delta_t, the tuple is simply ignored. Otherwise, the tuple is printed in the file 'output.txt'.

The algorithm can handle generalization when providing the attribute with a hierarchy using * as separator (max_generalization*...*min_generalization*attribute). Whenever releasing the attribute is not possible, the algorithm will look for the most specific generalization exposed by at least other z - 1 users in the past Delta_t. If none is found, nothing is print out. For the geolocation case, the algorithm divides in cells the territory (only Italy) with cells of differents sizes and outputs the cell with at most 5 level of details (3km, 5km, 10km, 30km, 500km).

Other methods

Run the study_output.py after the simulation to plot the distribution of z, pk and traffic during time. (You will find the plot 'z_tuning.pdf').

endFiles(): the file output.txt and counters.txt are intended for testing. They need to be closed at the end of the simulation (see example below).

duration() print the range of time covered.

Install

pip install zanon

Link to PyPI

Example of usage

from zanonymity import zanon

file_in = "trace.txt"
deltat = 3600 #in seconds
pk = 0.8
k = 2

z = zanon.zanon(deltat, pk, k)

for line in open(file_in, 'r'):
    t,u,a = line.split(",")
    z.anonymize((t,u,a))
z.endFiles()
z.duration()

Metadata

Release files for zanon 0.3.4

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

Source distribution (sdist)

Source distribution for zanon 0.3.4
File Size Uploaded
zanon-0.3.4.tar.gz 21.1 kB Details

Release files / zanon-0.3.4.tar.gz

Download URL zanon-0.3.4.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
575438c0d69d5fcac216b45178d08d4e0f6c4817b6aa337cf10ce4617653e5bc
BLAKE2b-256 checksum
How to use checksums
a436849177ebd16d454462470a8f4cff794cdd61f4b5a94a882bc39a0fa1775d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.30.0 setuptools/67.7.2 requests-toolbelt/0.8.0 tqdm/4.64.1 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.3.4 This release

1 release file

0.3.3

1 release file

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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