Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
RRC_steganography | Kitploit
Tools/GitHubGitHub/ryehr/rrc_steganography
SteganographyCryptographyMachine LearningPapers & ResearchLearning & EducationAI Security
GitHubryehr/rrc_steganography

RRC_steganography

View Repository
614 months agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

RRC Steganography

Rotation Range-Coding (RRC) Steganography — an efficient and provably secure linguistic steganographic method that embeds secret messages into natural-language text generated by large language models.

Paper: Efficient Provably Secure Linguistic Steganography via Range Coding

How It Works

StepDescription
Embed (Algorithm 3)Convert the secret message to a decimal value and iteratively rotate it within a shrinking interval guided by the LM's probability distribution and a PRNG-generated offset. Each rotation step produces one token.
Extract (Algorithm 4)Re-run the LM on the stegotext to recover interval bounds, then reverse-rotate back to the original decimal value and binarize it.

The rotation mechanism solves two issues of vanilla range-coding steganography:

  1. Probability-distribution preservation — the rotated secret value is uniformly distributed within each interval, so the token selection follows the original LM distribution.
  2. Fresh randomness — a new PRNG offset at each step prevents randomness reuse.

Repository Structure

root@kitploit:~
.
├── RRC_embed.py   # Embedding (Algorithm 3) 
├── RRC_extract.py   # Extraction (Algorithm 4) 
├── test_roundtrip.py         # Self-contained end-to-end verification script
├── requirements.txt          # Python dependencies
└── README.md

Requirements

  • Python ≥ 3.10
  • PyTorch ≥ 2.0
  • Transformers ≥ 4.35

Install dependencies:

root@kitploit:~
pip install -r requirements.txt

Quick Start

1. Verify correctness

The round-trip test uses meta-llama/Llama-2-7b-hf and runs on CPU/CUDA:

root@kitploit:~
python test_roundtrip.py

Expected output:

root@kitploit:~
>>> Step 3: Verification
    Original: 10110011001010111010011100101011...
    Extracted: 10110011001010111010011100101011...

    ✅ SUCCESS — extracted message matches perfectly!

2. Embed a secret message

Prepare a prompts file 0.Prompts.tsv with columns idx and text, then run:

root@kitploit:~
python RRC_embed.py \
    --language_model meta-llama/Llama-3.1-8B \
    --bit_length 128 \
    --key 42 \
    --top_k -1

3. Extract the secret message

root@kitploit:~
python RRC_extract.py \
    --language_model meta-llama/Llama-3.1-8B \
    --bit_length 128 \
    --key 42 \
    --input_file 1.RC_decimal_Llama-3.1-8B_bit128.tsv

⚠️ Important: The sender and receiver must use the same language model, key, bit length, and top-k setting for correct extraction.

CLI Arguments

RRC_embed.py

RRC_extract.py

Technical Note: Decimal Modulo

Python's Decimal type uses truncated division for the % operator, which can return negative remainders (e.g. Decimal('-19672') % Decimal('65536') → -19672 instead of 45864). This implementation uses a decimal_mod helper that guarantees the result is always in [0, m):

root@kitploit:~
def decimal_mod(a, m):
    return a - m * (a / m).to_integral_value(rounding=ROUND_FLOOR)

⚠️ For reliable secret extraction, some operations (sort, cumsum) are offloaded to CPU at float64 precision to avoid CUDA non-determinism. This trades a amount of speed for guaranteed encode–decode consistency.

Download Tool
ArgumentDefaultDescription
--language_modelmeta-llama/Llama-3.1-8BHuggingFace model identifier
--bit_length128Secret message length in bits
--top_k-1Top-k truncation; -1 = full vocabulary
--key42Symmetric key K (PRNG seed)
--part / --part_max0 / 2For parallel execution on large prompt sets
ArgumentDefaultDescription
--language_modelmeta-llama/Llama-3.1-8BMust match the embedding model
--bit_length128Must match the embedding setting
--top_k-1Must match the embedding setting
--key42Must match the embedding key
--input_file(required)Path to TSV from the encoder