Skip to main content

Anonymise identifiers / constants / metadata inside a CPython .pyc while preserving the opcode stream — for contamination-free decompiler benchmarking

Project description

pychd-pyobf

Anonymise identifiers, string constants, docstrings, and metadata inside a CPython .pyc while preserving the opcode stream exactly.

Built to neutralise LLM training-data memorisation when benchmarking Python decompilers: even if an LLM has seen the original source on the internet, the anonymised .pyc does not contain the surface tokens (variable names, comments, docstrings) it would use to recognise the source.

Covers every CPython release pychd recognises: 3.0–3.14.

  • 3.14 (the running interpreter) is rewritten natively via types.CodeType.replace().
  • 3.0–3.13 are rewritten via a subprocess into a uv-managed Python of that minor version, so the obfuscator stays a tiny dependency.

Pair with pychd-pyfuzz (random valid-Python source generator) for the strongest available contamination guarantee.

See the main pychd README for the broader story.

Install

pip install pychd-pyobf

Use

pychd-pyobf rewrite IN.pyc OUT.pyc --mapping mapping.json

The --mapping flag (optional) writes the original-to-anonymised identifier dict to JSON for audit / debugging. Without it, the mapping is discarded after rewriting.

Status

Pre-release. API and CLI are still evolving with the parent 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

pychd_pyobf-0.1.0.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

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

pychd_pyobf-0.1.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file pychd_pyobf-0.1.0.tar.gz.

File metadata

  • Download URL: pychd_pyobf-0.1.0.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pychd_pyobf-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3a1e839ec307f2a080fe695f84d14ef40289a45d4f005e3be6645c51c7f3a452
MD5 2ae7f2c2425b693eb180d65bc8dfaaa4
BLAKE2b-256 646ec8575e4ab5f8b7c03e6c174cb419871431a246a378b7bcf5ff954d643665

See more details on using hashes here.

Provenance

The following attestation bundles were made for pychd_pyobf-0.1.0.tar.gz:

Publisher: publish-pyobf.yaml on diohabara/pychd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pychd_pyobf-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pychd_pyobf-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pychd_pyobf-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e854f58fb482dc40c5ed65aa509b9d8d8f8520a315a04882d19e9018318543ac
MD5 124cb77496f265d379ebb3cb6d73b415
BLAKE2b-256 de9b9fbb74a9c2e22c065e395503369183d136f12196fc72cea3cc67dc430bfa

See more details on using hashes here.

Provenance

The following attestation bundles were made for pychd_pyobf-0.1.0-py3-none-any.whl:

Publisher: publish-pyobf.yaml on diohabara/pychd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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