Skip to main content

Module stego

Module stego 

Source
Expand description

Steganographic encoding and decoding pipelines.

This module provides two embedding modes:

  • Ghost (ghost_encode / ghost_decode): Stealth mode using J-UNIWARD cost function and Syndrome-Trellis Coding (STC) to minimize statistical detectability. Best for images that will not be recompressed.

  • Armor (armor_encode / armor_decode): Robustness mode using STDM (Spread Transform Dither Modulation) with Reed-Solomon error correction to survive JPEG recompression. Trades capacity for survivability.

Both modes share the same payload frame format, encryption (AES-256-GCM-SIV), and key derivation (Argon2id two-tier). The smart_decode function auto-detects which mode was used.

Re-exports§

pub use error::StegoError;
pub use armor::pipeline::armor_encode;
pub use armor::pipeline::armor_encode_with_quality;
pub use armor::pipeline::armor_decode;
pub use armor::pipeline::DecodeQuality;
pub use armor::pipeline::ArmorCapacityInfo;
pub use armor::pipeline::armor_capacity_info;
pub use armor::capacity::estimate_armor_capacity as armor_capacity;
pub use payload::PayloadData;
pub use payload::FileEntry;
pub use payload::compressed_payload_size;

Modules§

armor
Armor mode: robust steganography resistant to JPEG recompression.
capacity
Ghost mode capacity estimation.
cost
Embedding cost functions for steganographic coding.
crypto
Cryptographic primitives for payload encryption.
error
Error types for the steganography pipeline.
frame
Payload frame construction and parsing.
optimizer
Cover image preprocessing optimizer for steganographic embedding.
payload
Payload serialization, compression, and file embedding.
permute
Media-agnostic coefficient position permutation.
progress
Global decode progress tracking.
quality
Encode quality scoring: Stealth (Ghost) and Robustness (Armor).
shadow
Shadow messages: Y-channel direct LSB embedding + RS ECC (headerless brute-force).
shadow_layer
Media-agnostic shadow-layer primitives.
side_info
Side information for SI-UNIWARD (Side-Informed UNIWARD).
stc
Syndrome-Trellis Coding (STC) for minimal-distortion embedding.

Structs§

EncodeQuality
Encode quality result returned alongside stego bytes.
OptimizerConfig
Configuration for the cover image optimizer.
ShadowLayer
Shadow layer descriptor for encoding.

Enums§

OptimizerMode
Which optimization pipeline to run.

Constants§

ARMOR_TARGET_DIMENSION
Target pixel dimension (longest side) for Armor/Fortress pre-resize. Images larger than this are downsampled by the frontend before encoding in Armor mode, so that the 8×8 block grid survives platform recompression (e.g. WhatsApp resizes to ~1600px on the longest side).
GHOST_DECODE_STEPS
Total number of progress steps reported by ghost_decode.
GHOST_ENCODE_STEPS
Total number of progress steps reported by Ghost encode.
GHOST_ENCODE_WITH_SHADOWS_STEPS
Progress steps for Ghost encode with shadows.
MAX_DIMENSION
Maximum pixel dimension (width or height) for encode. Images exceeding this are downsampled by the frontend before reaching Rust.
MAX_PIXELS
Maximum total pixel count for encode (width × height). 200 MP covers all current cameras including flagship 200 MP sensors. Memory-optimized: strip-based UNIWARD (~170 MB/strip), compact positions (8 bytes each), segmented STC Viterbi. Total ~1 GB for 200 MP.
MIN_ENCODE_DIMENSION
Minimum pixel dimension (width or height) for encode. Images below this are rejected with an error message.

Functions§

estimate_shadow_capacity
Estimate shadow layer capacity for a JPEG image.
ghost_capacity
Estimate Ghost mode capacity (standard J-UNIWARD).
ghost_capacity_si
Estimate Ghost mode capacity with SI-UNIWARD (“Deep Cover”).
ghost_capacity_with_shadows
Estimate Ghost primary capacity accounting for shadow position overhead.
ghost_decode
Decode a payload from a stego JPEG using Ghost mode.
ghost_encode
Encode a text message into a cover JPEG using Ghost mode.
ghost_encode_si
Encode using Ghost mode with side information (SI-UNIWARD / “Deep Cover”).
ghost_encode_si_with_files
Encode with side information and file attachments.
ghost_encode_si_with_files_quality
Encode with SI-UNIWARD + files and return the encode quality score.
ghost_encode_si_with_quality
Encode with SI-UNIWARD and return the encode quality score.
ghost_encode_si_with_shadows
Encode with Ghost SI-UNIWARD plus shadow messages.
ghost_encode_si_with_shadows_quality
Encode with SI-UNIWARD + shadows and return the encode quality score.
ghost_encode_with_files
Encode a text message with file attachments into a cover JPEG using Ghost mode.
ghost_encode_with_files_quality
Encode with Ghost mode + files and return the encode quality score.
ghost_encode_with_quality
Encode with Ghost mode and return the encode quality score.
ghost_encode_with_shadows
Encode with Ghost mode plus shadow messages for plausible deniability.
ghost_encode_with_shadows_quality
Encode with Ghost mode + shadows and return the encode quality score.
ghost_shadow_decode
Decode a shadow message from a stego JPEG.
optimize_cover
Optimize raw RGB pixels for steganographic embedding.
shadow_capacity
Compute shadow capacity in plaintext bytes from Y nzAC count.
smart_decode
Unified decode: auto-detects Ghost or Armor mode from the embedded frame.
validate_encode_dimensions
Validate image dimensions for encoding.