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

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.2.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yacryptopan-1.0.2-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yacryptopan-1.0.2.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for yacryptopan-1.0.2.tar.gz
Algorithm Hash digest
SHA256 1942dc63d0d98c114b762bc9aa87489ff96fa67fb27c44eead49a3eb9b8064e3
MD5 d0b62b8cd8f426178423b225c4d2e05a
BLAKE2b-256 c0b0b8d1af85bf8c987eeea6fc1c379db5234568d5b6fc117497c6441f852af9

See more details on using hashes here.

File details

Details for the file yacryptopan-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: yacryptopan-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for yacryptopan-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bb596651cbed87f0de8abfb24a24bccb1f79cf9d6e631095512ebc7b132221a0
MD5 fbf2b654c210625665a976cbfd101f2f
BLAKE2b-256 1185a8d9d5d3cfa203508f368f16bb8e2a022f555996ae8f938ee1e9fef1818f

See more details on using hashes here.

Supported by

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