Skip to main content

Text steganography demo driven by next-token distributions

Project description

Ghostext

中文说明 / Chinese README

Ghostext is a text steganography demo. It encrypts your message first, then hides the ciphertext inside language-model token choices so the same model, prompt, passphrase, and seed can recover it later.

The default user path is now the real local llama.cpp backend.

Quick start

Install from PyPI with local-LLM support:

pip install ghostext[llm]

Run a quick encode/decode round-trip check:

ghostext encode \
  --prompt 'Write a short, natural paragraph about a quiet evening walk.' \
  --passphrase demo-pass \
  --message 'Meet near the riverside at seven.' \
| ghostext decode \
  --prompt 'Write a short, natural paragraph about a quiet evening walk.' \
  --passphrase demo-pass

See all command options:

ghostext --help
ghostext encode --help
ghostext decode --help

On the first run, Ghostext will:

  • look for a local model from --model-path
  • otherwise check GHOSTEXT_MODEL_PATH or GHOSTEXT_LLAMA_MODEL_PATH
  • otherwise download the default GGUF model to ~/.cache/ghostext/models/qwen35-2b-q4ks/

The default model is:

  • model id: Qwen/Qwen3.5-2B
  • repo: bartowski/Qwen_Qwen3.5-2B-GGUF
  • file: Qwen_Qwen3.5-2B-Q4_K_S.gguf

Everyday usage

Most of the time, encode only needs these arguments:

ghostext encode \
  --prompt '请写一段自然、连贯、简短的中文段落,描写傍晚散步时看到的街景。' \
  --passphrase 'river-pass' \
  --message '今晚七点在河边老地方见。'

decode reads the stego text from stdin by default, so a shell pipe stays short too:

ghostext encode \
  --prompt 'Write a short, natural paragraph about a quiet evening walk.' \
  --passphrase demo-pass \
  --message 'Meet near the riverside at seven.' \
| ghostext decode \
  --prompt 'Write a short, natural paragraph about a quiet evening walk.' \
  --passphrase demo-pass

If you want to keep the generated text:

ghostext encode \
  --prompt 'Write a short, natural paragraph about a quiet evening walk.' \
  --passphrase demo-pass \
  --message 'Meet near the riverside at seven.' \
  > stego.txt

ghostext decode \
  --prompt 'Write a short, natural paragraph about a quiet evening walk.' \
  --passphrase demo-pass \
  --text-file stego.txt

Defaults You No Longer Need To Tune

The CLI now comes with a real-model preset so users usually do not need to care about:

  • --seed unless you want a custom shared seed
  • --ctx-size
  • --batch-size
  • --top-p
  • --max-candidates
  • --min-entropy-bits
  • --totfreq

The current default preset is:

  • backend: llama-cpp
  • seed: 7
  • ctx size: 4096
  • batch size: 128
  • top-p: 0.995
  • max candidates: 64
  • min entropy bits: 0.0
  • total frequency: 4096

These are the values used when you do not override them.

Common overrides

Use a model you already have:

ghostext encode \
  --model-path /abs/path/to/model.gguf \
  --prompt 'Write a short paragraph about a quiet evening walk.' \
  --passphrase demo-pass \
  --message 'Meet near the riverside at seven.' \
| ghostext decode \
  --model-path /abs/path/to/model.gguf \
  --prompt 'Write a short paragraph about a quiet evening walk.' \
  --passphrase demo-pass

Change the default download directory:

GHOSTEXT_MODEL_DIR=/data/ghostext-models \
ghostext encode \
  --prompt 'Write a short paragraph about a quiet evening walk.' \
  --passphrase demo-pass \
  --message 'Meet near the riverside at seven.' \
| GHOSTEXT_MODEL_DIR=/data/ghostext-models \
  ghostext decode \
  --prompt 'Write a short paragraph about a quiet evening walk.' \
  --passphrase demo-pass

Show structured metadata:

ghostext encode \
  --json \
  --prompt 'Write a short paragraph about a quiet evening walk.' \
  --passphrase demo-pass \
  --message 'Meet near the riverside at seven.'

Disable logs when you want fully quiet output:

ghostext encode \
  --quiet \
  --prompt 'Write a short paragraph about a quiet evening walk.' \
  --passphrase demo-pass \
  --message 'Meet near the riverside at seven.'

More detail

Use spec.md if you want the protocol-level design and implementation notes. The README is intentionally optimized for getting from install to a working round-trip as quickly as possible.

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

ghostext-0.1.1.tar.gz (33.6 kB view details)

Uploaded Source

Built Distribution

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

ghostext-0.1.1-py3-none-any.whl (29.3 kB view details)

Uploaded Python 3

File details

Details for the file ghostext-0.1.1.tar.gz.

File metadata

  • Download URL: ghostext-0.1.1.tar.gz
  • Upload date:
  • Size: 33.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for ghostext-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6f6504b326cffcf3d8c833d279d6bafedc89c32babb9927e931548e2783b093f
MD5 fade04ca2ba181c125e6a39be8a5a25b
BLAKE2b-256 4829151a8bb79b1af99432a7a46148d5aaf6115857ab42b5fa7d512e03712a70

See more details on using hashes here.

File details

Details for the file ghostext-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ghostext-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 29.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for ghostext-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a81669b1423fb942aa76fe75544c14e1b8a77834e6fe88e39e86c3cc2a1e69b3
MD5 75dbebedfb87f4a3abf5962073667731
BLAKE2b-256 9385fb7febc481c6cc9cf8029cad8d5014f16613eccbeb3ec1e66057cf93ea9c

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