Skip to main content

# Yet another Crypto-PAn implementation for Python

## Overview

This package provides a function to anonymize IP addresses keeping their prefix consistency. This program is based on the paper “Prefix-Preserving IP Address Anonymization: Measurement-based Security Evaluation and a New Cryptography-based Scheme” written by Jun Xu, Jinliang Fan, Mostafa H. Ammar, and Sue B. Moon. The detailed explanation can be found in [Xu2002].

This package supports both IPv4 and IPv6 anonymization.

## Usage

>>> from yacryptopan import CryptoPAn
>>> cp = CryptoPAn(b'32-char-str-for-AES-key-and-pad.')
>>> cp.anonymize('192.0.2.1')
'192.0.125.244'
>>> cp.anonymize_bin(0xc0000201, version=4)
3221257716L
>>> cp.anonymize('2001:db8::1')
'27fe:8bc7:fee:1e:1e1f:f0fe:f0e1:83fd'
>>> cp.anonymize_bin(0x20010db8000000000000000000000001, version=6)
53161570263948813229648829710638089213L

## Code

The source code is available at https://github.com/keiichishima/yacryptopan

This module works with Python3.

## Bug Reports

Please submit bug reports or patches through the GitHub interface.

## References

[Xu2002] Jun Xu, Jinliang Fan, Mostafa H. Ammar, and Sue B. Moon, “Prefix-Preserving IP Address Anonymization: Measurement-based Security Evaluation and a New Cryptography-based Scheme”, in Proceedings of the IEEE International Conference on Network Protocols, Paris, 2002.

## Contributors

## Author

Keiichi SHIMA / IIJ Innovation Institute Inc. / WIDE project

Metadata

Release files for yacryptopan 1.0.2

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

Source distribution (sdist)

Source distribution for yacryptopan 1.0.2
File Size Uploaded Provenance Actions
yacryptopan-1.0.2.tar.gz 4.8 kB Without provenance Details for yacryptopan-1.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 9.9 kB

Release files / yacryptopan-1.0.2.tar.gz

Download URL yacryptopan-1.0.2.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1942dc63d0d98c114b762bc9aa87489ff96fa67fb27c44eead49a3eb9b8064e3
BLAKE2b-256 checksum
How to use checksums
c0b0b8d1af85bf8c987eeea6fc1c379db5234568d5b6fc117497c6441f852af9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / yacryptopan-1.0.2-py3-none-any.whl

Download URL yacryptopan-1.0.2-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb596651cbed87f0de8abfb24a24bccb1f79cf9d6e631095512ebc7b132221a0
BLAKE2b-256 checksum
How to use checksums
1185a8d9d5d3cfa203508f368f16bb8e2a022f555996ae8f938ee1e9fef1818f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for yacryptopan 1.0.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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