Skip to main content

Yet another Crypto-PAn implementation for Python

Project description

# 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('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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yacryptopan-1.0.1.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file yacryptopan-1.0.1.tar.gz.

File metadata

  • Download URL: yacryptopan-1.0.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for yacryptopan-1.0.1.tar.gz
Algorithm Hash digest
SHA256 850cb354e1c79581453f0042e3d08736fbe53273d1622de7da275cbb861323b0
MD5 a48ad409b881ed0bf95c57f9104ec7a6
BLAKE2b-256 741994a09de80a71a8fb183a1f820082e4f551552fee54c5e872e718b031ed9f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page