Crate anyhide

Crate anyhide 

Source
Expand description

§Anyhide - Hide anything in anything

Anyhide is a steganography tool that hides messages within pre-shared carriers (text, images, audio, or any file).

§Overview

Anyhide uses a pre-shared carrier approach with enhanced security:

  • Both parties agree on a carrier beforehand (text, image, or audio file)
  • Message is fragmented into variable-sized pieces based on passphrase
  • Fragments are found as substrings (text) or byte sequences (binary)
  • Positions are distributed randomly across all occurrences
  • Message is padded to block boundaries to hide length
  • Positions are encrypted with passphrase (symmetric) and public key (asymmetric)
  • Only the encrypted code is transmitted (carrier never transmitted!)

§Security Model

  • Four-factor security: Carrier + Passphrase + Private Key + Correct Version
  • Substring matching: “ama” found in “Amanda” - works across languages
  • Random positions: Fragment 1 can be at end, Fragment 5 at start
  • Never fails: Wrong inputs return garbage, not error
  • Block padding: Message length hidden (only block range visible)
  • Distributed selection: Multiple occurrences = random selection
  • Multi-carrier: Text, PNG/BMP images, WAV audio all supported

§Example Usage

use anyhide::crypto::KeyPair;
use anyhide::{encode, decode};

// Both parties have the same carrier text
let carrier = "Amanda fue al parque con su hermano ayer por la tarde";

// Generate keys
let recipient_keys = KeyPair::generate();

// Encode a message - fragments found as substrings
let encoded = encode(
    carrier,
    "ama parque",
    "secret_passphrase",
    recipient_keys.public_key()
).unwrap();

// Only encoded.code is transmitted
println!("Transmit this: {}", encoded.code);

// Decode - NEVER fails, returns garbage if wrong
let decoded = decode(
    &encoded.code,
    carrier,
    "secret_passphrase",
    recipient_keys.secret_key()
);

println!("Decoded: {}", decoded.message);

§Modules

  • crypto: Cryptographic operations (key generation, encryption)
  • text: Text/carrier processing (fragmentation, substring search, padding)
  • encoder: Message encoding with fragments and padding
  • decoder: Message decoding (never fails)
  • qr: QR code generation and reading

Re-exports§

pub use crypto::KeyPair;
pub use crypto::KeyType;
pub use crypto::SigningKeyPair;
pub use crypto::encode_ephemeral_public_key_pem;
pub use crypto::encode_ephemeral_secret_key_pem;
pub use crypto::decode_public_key_pem_with_type;
pub use crypto::decode_secret_key_pem_with_type;
pub use crypto::load_public_key_with_type;
pub use crypto::load_secret_key_with_type;
pub use crypto::save_ephemeral_public_key_pem;
pub use crypto::save_ephemeral_private_key_pem;
pub use crypto::detect_key_type;
pub use crypto::ContactKeys;
pub use crypto::EphemeralStoreError;
pub use crypto::EphemeralStoreFormat;
pub use crypto::load_unified_keys_for_contact;
pub use crypto::save_unified_keys_for_contact;
pub use crypto::update_unified_public_key;
pub use crypto::update_unified_private_key;
pub use crypto::load_private_key_for_contact;
pub use crypto::save_private_key_for_contact;
pub use crypto::load_public_key_for_contact;
pub use crypto::save_public_key_for_contact;
pub use crypto::list_unified_contacts;
pub use crypto::list_private_key_contacts;
pub use crypto::list_public_key_contacts;
pub use crypto::generate_and_save_ephemeral_for_contact;
pub use decoder::decode;
pub use decoder::decode_bytes_with_carrier;
pub use decoder::decode_bytes_with_carrier_config;
pub use decoder::decode_with_carrier;
pub use decoder::decode_with_carrier_config;
pub use decoder::decode_with_config;
pub use decoder::DecodedBytes;
pub use decoder::DecodedMessage;
pub use decoder::DecoderConfig;
pub use encoder::encode;
pub use encoder::encode_bytes_with_carrier;
pub use encoder::encode_bytes_with_carrier_config;
pub use encoder::encode_with_carrier;
pub use encoder::encode_with_carrier_config;
pub use encoder::encode_with_config;
pub use encoder::EncodedData;
pub use encoder::EncodedMessage;
pub use encoder::EncoderConfig;
pub use encoder::EncoderError;
pub use qr::decode_base45;
pub use qr::encode_base45;
pub use qr::generate_qr;
pub use qr::read_qr;
pub use qr::QrError;
pub use qr::QrFormat;
pub use text::carrier::fragment_bytes_for_carrier;
pub use text::carrier::BinaryCarrierSearch;
pub use text::carrier::BinaryFragment;
pub use text::carrier::Carrier;
pub use text::fragment::FoundFragment;

Modules§

crypto
Cryptographic operations for Anyhide.
decoder
Message decoding for Anyhide steganography.
encoder
Message encoding for Anyhide steganography.
qr
QR code generation and reading for Anyhide codes.
text
Text processing for Anyhide steganography.

Constants§

BLOCK_SIZE
Block size for padding (in characters)
MIN_SIZE
Minimum message size before padding (in characters)
VERSION
Protocol version