Skip to main content

ghost_encode_si

Function ghost_encode_si 

Source
pub fn ghost_encode_si(
    image_bytes: &[u8],
    raw_pixels_rgb: &[u8],
    pixel_width: u32,
    pixel_height: u32,
    message: &str,
    passphrase: &str,
) -> Result<Vec<u8>, StegoError>
Expand description

Encode using Ghost mode with side information (SI-UNIWARD / “Deep Cover”).

When the original uncompressed pixels are available (non-JPEG input like PNG, HEIC, or RAW), the quantization rounding errors enable more efficient embedding — roughly 1.5-2× capacity at the same detection risk.

The raw_pixels_rgb must be the ORIGINAL pixels that were JPEG-compressed to produce image_bytes. They must have the same dimensions.

§Arguments

  • image_bytes: Cover JPEG (as compressed by the platform from the raw pixels).
  • raw_pixels_rgb: Original RGB pixels, row-major, 3 bytes per pixel.
  • pixel_width, pixel_height: Dimensions of the raw pixel buffer.
  • message: Plaintext message to embed.
  • passphrase: Used for structural key derivation and encryption.