Skip to main content

hide_encrypt

Function hide_encrypt 

Source
pub fn hide_encrypt<T>(
    info: T,
    carrier_template: &str,
) -> Result<String, HideSomethingError>
where T: ToString,
Expand description

Hides the given information into a carrier text.

§Process

  1. Compress the input string with raw DEFLATE.
  2. Prepend a 4‑byte big‑endian length prefix.
  3. Convert the resulting byte vector into a stream of bits (MSB first).
  4. Repeat the carrier template until it contains at least as many alphabetic characters as there are bits.
  5. Encode each bit by setting the corresponding alphabetic character to uppercase (bit = 1) or lowercase (bit = 0). Non‑alphabetic characters are left unchanged.

§Errors

Returns HideSomethingError if compression fails, or if the template contains no alphabetic characters.

§Example

use hide_something::hide_encrypt;
let hidden = hide_encrypt("secret", "Hello World!").unwrap();
assert!(hidden.len() > 0);