Skip to main content

Protect text from AI using invisible Unicode characters

Project description

Gibberifire 🔥

PyPI version Python versions License CI

Gibberifire is a Python library and CLI tool designed to "protect" text by corrupting what either humans or LLMs see. It can inject invisible/visually identical Unicode noise to keep text human-readable but model-hostile, or, conversely, encode text so it is LLM-readable but human-gibberish.

Warning: This tool is for education and research. Obfuscation can be removed by models or cleaning scripts. API stability is not guaranteed until 1.0.0 (SemVer 0.x rules).

Features

  • Invisible Protection: Uses Zero-Width Spaces (ZWSP), Homoglyphs, Combining Characters, and Bidirectional (Bidi) markers to fool LLMs while keeping humans comfortable.
  • Human-Obscuring Encoding: New encoding method (hex/emoji) makes text hard to read for humans but straightforward for LLMs to decode.
  • Reversibility: Provides a clean method to restore the original text for both directions.
  • Detection: Can detect if text has been "protected"/encoded.
  • Configurable Profiles: Use built-in profiles (low, medium, high, encoded) or create your own flexible configuration.
  • Async Support: Fully supports asynchronous operations.
  • CLI: Unix-style command line interface (works with pipes).

Installation

pip install gibberifire

Usage

CLI

The CLI is designed to work with standard input (STDIN) and standard output (STDOUT).

Basic Usage:

# Protect text from a pipe
echo "Hello World" | gibberifire protect > protected.txt

# Clean text
cat protected.txt | gibberifire clean

# Detect protection (returns exit code 0 if protected, 1 if clean)
cat file.txt | gibberifire detect

With Profiles:

# Use 'high' profile
cat data.txt | gibberifire protect -p high > protected.txt

# Clean using specific profile pipeline (recommended)
cat protected.txt | gibberifire clean -p high > restored.txt

# Make text LLM-readable but human-gibberish
echo "Secret plan" | gibberifire protect -p encoded > encoded.txt

# Clean using the same profile
cat encoded.txt | gibberifire clean -p encoded > restored.txt

With Custom Config:

cat data.txt | gibberifire -c ./my_config.yaml protect -p custom_profile

Python API

from gibberifire import Gibberifire, Profile, PipelineStep
from gibberifire.core.models import ZWSPParams, HomoglyphParams, DEFAULT_PROFILES

profile = DEFAULT_PROFILES["medium"]
gf = Gibberifire(profile=profile)

protected = gf.protect("Hello, World!")
print(protected)

cleaned = gf.clean(protected)
assert cleaned == "Hello, World!"

Async API

import asyncio

from gibberifire import AsyncGibberifire, PipelineStep, Profile
from gibberifire.core.models import ZWSPParams


async def main() -> None:
    custom_profile = Profile(
        description="Async demo using a lighter ZWSP mix",
        pipeline=[
            PipelineStep(
                method="zwsp",
                params=ZWSPParams(min_burst=2, max_burst=6, seed=42),
            ),
        ],
    )

    async with AsyncGibberifire(profile=custom_profile) as gf:
        protected = await gf.protect("Async hello from Gibberifire!")
        print(protected)

        if await gf.is_protected(protected):
            restored = await gf.clean(protected)
            print(restored)


asyncio.run(main())

Configuration File Example

profiles:
  my_custom_profile:
    description: "Custom protection mix"
    pipeline:
      - method: zwsp
        params:
          min_burst: 2
          max_burst: 5
          preserve_emoji: true
          seed: 123
      - method: homoglyph
        params:
          probability: 0.3

Further Reading

  • See the Deep Dive section for a detailed walkthrough of methods, defaults, and limitations.

Versioning & Releases

  • SemVer 0.x: breaking changes are possible until 1.0.0.
  • Release notes live in CHANGELOG.md.

Contributing & Security

  • Contributions are welcome—see CONTRIBUTING.md.
  • Responsible use, limitations, and reporting guidance are in SECURITY.md. There is no warranty; use at your own risk.

License

MIT. See LICENSE.

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

gibberifire-0.1.0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

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

gibberifire-0.1.0-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gibberifire-0.1.0.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gibberifire-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b8483a4685dfdbd10ae209add92e8f0517ccedb8ebb2d48122def183e975522a
MD5 9cc77342ef3c102e63c0a412584b9568
BLAKE2b-256 8dd4940913798b31ceb61302898f8b93ed97dd28dc84d3857f2151f34d900280

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gibberifire-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gibberifire-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ba949d1e484cd994ab2a8369396d216241cb1a9497be28fad1d558983fb77825
MD5 b5e43864b4a1374d0e437353889906f9
BLAKE2b-256 567ec4b85a2109697c75782d7b109da917767f8b7373d3b55f78fc013af20b21

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