File Format and Cryptography

Stegodon embeds a compact metadata header followed by the payload. This page documents the header fields, symbol encoding, randomization, and encryption behavior.

Stegodon Header

Every embedded payload begins with a compact binary header.

The header starts with the magic bytes:

SGDN

Header Layout

FieldSizeDescription
Magic4 bytesASCII SGDN
Version1 byteFormat version, currently 1
Header length2 bytesTotal header length in bytes
Flags1 byteEmbedding options and payload type
Channel mask1 byteImage channel mask (R/G/B)
Payload length4 bytesPayload length in bytes
Filename length2 bytesFilename byte length
FilenamevariablePresent for file payloads
Salt16 bytesPresent when encryption is enabled
IV12 bytesPresent when encryption is enabled

Minimum header length is 15 bytes.

Flags

The flags byte stores:

  • encryption enabled
  • randomized placement enabled
  • file payload enabled
  • LSB depth

Encoded meanings

Flag componentMeaning
bit 0encryption enabled
bit 1randomized placement enabled
bit 2payload is a file
bits 3–4LSB count minus 1

Channel Mask

For images, the channel mask describes which RGB channels were used.

BitChannel
1Red
2Green
4Blue

Examples:

MaskMeaning
1R
2G
4B
7R+G+B

WAV carriers store 0 here because image channel selection does not apply.

Symbol Encoding

Stegodon converts bytes into embedding symbols according to the selected LSB depth.

1-bit mode

Each bit becomes one symbol.

2-bit mode

Bits are grouped into 2-bit symbols.

These symbols are then written into least significant bits of image channels or WAV samples.

Sequential Header, Optional Randomized Payload

The header is always written sequentially at the beginning of the carrier's embedding positions.

This allows extraction and detection to discover the file format and settings.

The payload may be:

  • sequential
  • randomized

Randomization

When randomization is enabled:

  1. Stegodon derives a seed from the passphrase
  2. It computes SHA-256 over:
STEGO-SEED::<passphrase>
  1. It uses the first 4 bytes as a seed
  2. It creates an xorshift32 PRNG
  3. It shuffles the available payload positions with Fisher–Yates

This means the same passphrase is required to reconstruct the payload order during extraction.

Encryption

When encryption is enabled:

  • algorithm: AES-GCM
  • key size: 256-bit
  • key derivation: PBKDF2
  • hash: SHA-256
  • iterations: 150,000
  • salt: 16 bytes
  • IV: 12 bytes

The salt and IV are stored in the header so the payload can be decrypted later with the correct passphrase.

File Payload Metadata

If the payload is a file, the original filename is stored in the header and shown again during extraction.

The filename is encoded as UTF-8 bytes.

Carrier-Specific Embedding

Images

Stegodon writes symbols into RGB byte positions in the selected order.

It does not use the alpha channel.

WAV

Stegodon writes symbols into the least significant bits of 8-bit or 16-bit PCM samples.

Output Preservation

Images

Stegodon outputs PNG to preserve hidden bits.

WAV

Stegodon writes the modified WAV byte structure back out directly.

Compatibility Notes

A file can only be reliably extracted if:

  • the Stegodon header remains intact
  • the carrier format preserves the hidden bits
  • the same passphrase is supplied when required

Security Notes

  • Encryption protects the payload content
  • Randomization obscures placement
  • Randomization alone does not encrypt the data
  • Encryption alone does not randomize where the data is placed
  • A weak passphrase weakens both encrypted and randomized workflows

Ethics

Steganography should only be used for lawful and ethical purposes.


Did this page help you?