Skip to main content

No project description provided

Project description

NameChameleon

A Python tool for anonymizing Excel and CSV files with deterministic pseudonymization.

Features

  • Deterministic anonymization using salted HMAC-SHA256
  • Support for multiple column types: first_name, last_name, full_name, full_name_inverted, email, id, clear
  • Excel multi-sheet support
  • Extensible OOP architecture
  • Dynamic name generation using Faker

Installation

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install -e .  # Install CLI tool

Usage

CLI Tool

# Interactive mode - select column types interactively
chameleon anonymize input.xlsx output.xlsx -i

# Using a config file
chameleon anonymize input.csv output.csv -c examples/config.json

# Show available columns in a file
chameleon columns input.xlsx

# With salt for reproducibility
chameleon anonymize input.csv output.csv -c config.json --salt a1b2c3d4... --show-salt

# Different locale
chameleon anonymize input.xlsx output.xlsx -i --locale fi_FI

Python API

from namechameleon import Anonymizer

# Map your column names to namechameleon types
column_config = {
    'FirstName': 'first_name',      # Column name in your file → type
    'LastName': 'last_name',
    'Email': 'email',
    'EmployeeID': 'id',
    'Notes': 'clear'
    # Columns not listed here remain unchanged
}

anonymizer = Anonymizer(column_config=column_config, locale='en_US')

# Excel (processes all sheets)
anonymizer.anonymize_excel('input.xlsx', 'output.xlsx')

# CSV
anonymizer.anonymize_csv('input.csv', 'output.csv')

# Save salt for reproducibility (optional)
salt = anonymizer.get_salt()
print(f"Salt: {salt.hex()}")

# Reuse salt for consistent results
anonymizer2 = Anonymizer(column_config=column_config, salt=salt)

Input

FirstName LastName FullName Email EmployeeID Department Notes
John Smith John Smith john.smith@company.com EMP001 Engineering Private info 1
Alice Johnson Alice Johnson alice.johnson@company.com EMP002 Sales Confidential 2
Bob Anderson Bob Anderson bob.anderson@example.org EMP003 Marketing Secret 3
Mary Brown Mary Brown mary.brown@company.com EMP004 Engineering Internal 4

Output

FirstName LastName FullName Email EmployeeID Department Notes
Patrick Lowe Patrick Lowe patrick.lowe@company.com JQ3O81FS Engineering
Jason Williams Jason Williams jason.williams@company.com 0CB4RISP Sales
Sheila Flores Sheila Flores sheila.flores@example.org 0VQ5XJRZ Marketing
Lauren Bush Lauren Bush lauren.bush@company.com XBIGNGA8 Engineering

Note: Department column remains unchanged (not in column_config), while Notes are cleared (clear type).

Column Types

  • first_name: Anonymizes to realistic first names
  • last_name: Anonymizes to realistic last names
  • full_name: Anonymizes full names in natural order (First Middle... Last)
    • Example: "John Michael Smith""Jennifer Emily Thompson"
    • Single name treated as first name
  • full_name_inverted: Anonymizes full names in inverted order (Last First Middle...)
    • Example: "Smith John Michael""Thompson Jennifer Emily"
    • Single name treated as last name
  • email: Generates email from anonymized names (see below)
  • id: Hashes to 8-character alphanumeric ID
  • clear: Replaces with empty string (clears)

Note: Columns not in column_config remain unchanged.

Email Handling

Email anonymization preserves the domain and only treats dot (.) as a name separator:

john.smith@company.com    → michael.jones@company.com    (two parts: first.last)
alice@example.com         → sarah@example.com            (single name)
alice_johnson@company.com → sarah@company.com            (underscore NOT a separator)

For consistency across columns, use dot-separated emails (e.g., john.smith@domain.com) that match your FirstName and LastName columns.

Architecture

namechameleon/
├── core/
│   ├── anonymizer.py        # Main Anonymizer class
│   └── column_handlers.py   # Handler for each column type
└── utils/
    ├── normalizer.py        # String normalization
    ├── hasher.py            # Deterministic hashing
    └── name_generator.py    # Dynamic name generation

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

namechameleon-0.1.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

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

namechameleon-0.1.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for namechameleon-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b36a8b9cdfbb3da8148cdca8e97a8c305cbe1675f806b35497400bdf2bbd9d42
MD5 2c5bfc9fc293a1129476ed61ecd11063
BLAKE2b-256 10f40ed32d8a987f655b26fa6c9187908d86bbcb0c84285532242c3aaca5a2fc

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for namechameleon-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 13e9ce6e610aa09e4b8b49d0bd858504b03f4036d2b3aa7a7fd94b205ff1054e
MD5 49720e48b3f737a880a4c40fe856a621
BLAKE2b-256 d62c164ce0186f80a5202dfd1fd4dcf834023c3bbd495e77f1521481352e194d

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