csha
    • CSha
    • Building and installation
    • Commands and examples
    • Architecture
    • Changelog
    • AI usage
    • License
    • Quick start
    • Blob Streams
    • Docker images as PNGs
    • Formats and keys
    • C++ API
    • Troubleshooting
    • Encryption algorithms
    • Testing

    Commands and examples

    Use ./build/csha from a build tree or csha after installation. Start with
    Quick start for a complete walkthrough. The three command forms
    are:
    csha -M MODE [IMAGE_AND_MAP_OPTIONS]
    csha blob-streams COMMAND [STREAM_OPTIONS]
    csha docker-image COMMAND [DOCKER_OPTIONS]
    Subcommands have their own parsers. Image flags such as -M, -p, and -o
    do not configure Blob Streams or Docker image commands.

    Choose a mode#

    Use the short name or its long alias with -M. The table describes the current
    behavior, including modes that produce metadata rather than recovered files.
    ModeAliasInput and behaviorOutput / recovery
    ffullOrdinary path encodes -P using -p; with two --key-image values, encodes -s or -f insteadEnvironment PNG / fd
    fdfull-decodeRead an environment map with matching credentialsPlaintext display; image-pair path supports exact file output with -o
    fzfull-zipRead -z archive into environment map(s)Master map and, for larger inputs, companion chunks / fdz
    fdzfull-decode-zipRead a single map, master map with companion chunks, or legacy mosaicArchive at -Z
    ensencode-no-seedEncrypt -P with -pAES PNG / di or pd
    ewsencode-with-seedEncrypt -P; optionally render the separate -S seedWrites encoded.png plus the optional map
    esencode-stringEncrypt text from -sAES PNG / di or ds
    efencode-fileRead binary bytes from -f and encryptAES PNG / API for exact file output; di displays text
    ezencode-zipRead and Base64-wrap an archive from -zAES PNG / dz
    dsdecode-stringDecode an AES imageLabeled plaintext on stdout
    didecode-imageDecode an AES imageLabeled plaintext on stdout
    dmdecode-mapRead visible seed metadataSeed, version, and spawn details
    dzdecode-zipDecode a ZIP AES imageRestored archive at required -Z path
    mfsmap-from-stringRender numeric seed supplied by -SSeed map PNG
    mfimap-from-imageRead a seed from image metadata, or hash the image with -gPrinted seed; -G also writes its map
    mfzmap-from-zipEncrypt an archive, then derive a seed from that imagePrinted seed; does not preserve the archive in a generated seed map
    mtsmap-to-stringRead seed metadataFirst seed and hex representation
    mtimap-to-imageRead and save a map imagePNG copy, not decryption
    mtzmap-to-zipExport seed metadata via system zipMetadata archive; legacy path
    pepure-encodeEncrypt plaintext from -P using -pAES PNG / pd
    pdpure-decodeDecode an AES imageLabeled plaintext on stdout
    Use explicit -M: the default and unknown-mode fallback are f. -e and
    -d add validation checks but do not change -M. See
    Troubleshooting for known edge cases.

    Image and map options#

    OptionMeaning
    -h, --helpShow usage
    -v, --versionShow the executable version
    -M, --mode MODESelect an image/map mode
    -s, --string TEXTInput text for es or image-pair f
    -f, --file PATHFile input for ef or image-pair f
    -z, --zip PATHArchive input
    -i, --image PATHInput image, mutually exclusive with data URL input
    -o, --output PATHGenerated image; decoded file output in image-pair fd
    -Z, --zip-output PATHRestored or exported ZIP path
    -p, --public-key VALUESymmetric encryption-key input despite the historical name
    -P, --password VALUEPlaintext or environment password, depending on mode
    -A, --aes-mode MODEGCM (default), CBC, or CTR
    -k, --key-derive MODEPBKDF2 (default), DIRECT, or FIXED
    -S, --seed VALUENumeric Minecraft seed
    -m, --mc-version VALUEProject's Minecraft version selector; default 18
    -a, --salt VALUEImage-to-seed salt; not the AES derivation salt
    -g, --gen-seedHash input image to derive a seed
    -G, --gen-mapGenerate a map from the derived seed in mfi / mfz
    --image-data-url VALUELiteral PNG data URL or @file
    --data-url-output PATHSave a complete PNG data URL alongside supported image output
    --cipher NAMEChoose AES or one of ten additional authenticated ciphers
    --list-ciphersList supported cipher names
    --key-image PATHRepeat twice to encode an image-password map; once to decode
    Key and password semantics are explained in Formats and keys.
    For new command examples, specify matching AES settings at both ends when
    using non-default values. The FIXED derivation uses a built-in constant key.

    Output behavior#

    Use explicit output paths in scripts. Ordinary es, ez, and pe default to
    encoded.png; ef defaults to encoded_file.png; ordinary f defaults to
    output.png; mfs defaults to map.png; image-pair f defaults to
    pair-map.png. Ordinary image outputs may overwrite existing files.
    di, ds, and pd print diagnostics plus a labeled plaintext value. Redirecting
    stdout is not an exact binary file recovery interface. Use ez / dz for
    archives, image-pair fd -o for its files, or the C++ API.
    Blob Streams sends diagnostics to stderr and received bytes to stdout; Docker
    PNG commands refuse to overwrite their key/archive/image outputs.
    Use --cipher NAME to select one of ten non-AES authenticated algorithms;
    --list-ciphers lists them. See encryption algorithms.

    Text and files#

    ./build/csha -M es -s "Hello World" -p example-key -o encoded.png
    ./build/csha -M di -i encoded.png -p example-key
    
    ./build/csha -M ef -f input.txt -p example-key -o file.png
    ./build/csha -M di -i file.png -p example-key
    For ef, the decode command above demonstrates readable text only. For an
    exact binary file recovery, choose the ZIP route below or the C++ API.

    ZIP data#

    ./build/csha -M ez -z archive.zip -p example-key -o archive.png
    ./build/csha -M dz -i archive.png -p example-key -Z restored.zip

    Minecraft maps#

    ./build/csha -M mfs -S 12345678 -m 18 -o map.png
    ./build/csha -M dm -i map.png
    Keep generated images as PNGs to preserve the embedded pixel data. To derive a
    seed and map from an arbitrary image:
    ./build/csha -M mfi -i input.png -g -G -o derived-map.png
    ./build/csha -M mfz -z archive.zip -p example-key -g -G -o zip-seed-map.png
    No -S is needed for these derived seeds. A seed map retains the derived seed,
    not the original image or archive bytes.

    Ordinary environment maps#

    ./build/csha -M f -P demo-message -p demo-key -o environment.png
    ./build/csha -M fd -i environment.png -P demo-message -p demo-key
    Without image credentials, f currently encodes the -P value itself. It does
    not read -s or -f as an independent payload. Use image-pair mode below for
    those inputs, or the library's generate_env_map(data, password, key) API.
    For a ZIP distributed across environment maps:
    ./build/csha -M fz -z archive.zip -P map-password -p example-key -o archive-map.png
    ./build/csha -M fdz -i archive-map.png -P map-password -p example-key -Z restored.zip
    cmp archive.zip restored.zip
    For larger inputs, keep archive-map.png together with archive-map.chunks/
    and all its numbered chunk_0.png, chunk_1.png, … files. fdz finds the
    companion directory from the master map's basename and restores chunks in
    order. Missing or undecodable chunks fail recovery. Small inputs use one map.

    Seed metadata row#

    Generated maps keep visible seed metadata entirely in the first row. If the
    seed list exceeds the current width (more than 56 seeds at 512 pixels), the map
    widens by a whole horizontal scale factor using nearest-neighbor sampling. No
    seed entries are dropped, and the decoder still accepts older multi-row maps.
    This applies to seed metadata, including the final map in a chunked ZIP export;
    environment-map payloads still use low-order bits throughout the map.

    Large-file encoding#

    AES images use a versioned binary pixel format with an explicit ciphertext
    length. Encoding and decoding avoid per-pixel hex strings; library calls work
    in memory instead of writing intermediate PNGs. The CLI still writes the
    requested output image. ZIP payloads retain the existing Base64 convention.
    The updated decoder reads legacy images as well as the new format. New AES
    images require this updated decoder; older binaries do not understand the
    length header. Existing legacy images whose ciphertext ended in zero retain
    the old format's ambiguous padding limitation. PNG remains required.
    Environment-map capacity checks now count four channels per encoded byte and
    reject oversize payloads instead of silently truncating or returning raw
    ciphertext pixels as a map. This is an in-memory optimization, not streaming;
    large inputs still need memory proportional to their size.
    Local Release-build check (2026-10-15, macOS, 8 MiB stored ZIP): encode plus
    decode fell from 2.445 s to 0.317 s (about 7.7x). Both restored ZIPs matched the
    original byte-for-byte. This is one local measurement, not a cross-machine
    performance guarantee. Binary round-trip tests cover CBC, CTR, GCM, PNG reloads,
    non-contiguous images, a trailing-zero ciphertext, and legacy format reads.

    Base64 PNG data URLs#

    Export a generated image to a text file containing a complete data URL:
    ./build/csha -M es -s "Hello" -p example-key -o encoded.png --data-url-output encoded.url
    ./build/csha -M di --image-data-url @encoded.url -p example-key
    --image-data-url also accepts a literal data:image/png;base64,... value.
    Use @file for large images to avoid shell argument-size limits. Data URLs are
    self-contained and do not upload an image or create a hosted HTTPS link. PNG
    bytes and pixel values are preserved; malformed Base64 and other MIME types
    are rejected. Multi-map ZIP modes do not support data URL output.

    Either-image passwords#

    ./build/csha -M f -s "secret data" --key-image first.png --key-image second.png -o pair-map.png
    ./build/csha -M fd -i pair-map.png --key-image first.png
    ./build/csha -M fd -i pair-map.png --key-image second.png
    Use -f input.bin when encoding a file and -o restored.bin when decoding.
    Both supplied images independently unlock the same payload. A random data key
    encrypts the payload once; each image's SHA-256 digest separately wraps that
    key. AES-GCM is the default for both operations; --cipher NAME selects an
    alternative for both. Image filenames and file metadata are not keys:
    dimensions and decoded BGR pixels are. Keep at least one original image for recovery;
    resizing, editing or JPEG recompression changes the key. Anyone possessing
    either image can unlock the map.
    Pair maps have a distinct format, preserve their seed entry, require PNG, and
    accept up to 196,432 plaintext bytes with AES or 196,288 with an alternative
    cipher in one 512-by-512 map. Oversize input fails before generation. Pair mode
    uses authenticated encryption and image-derived keys; -p, -A, and -k
    do not configure its credentials. Older binaries cannot decode new pair formats.
    Image-pair maps also support data URLs:
    ./build/csha -M f -s "secret data" --key-image first.png --key-image second.png -o pair-map.png --data-url-output pair-map.url
    ./build/csha -M fd --image-data-url @pair-map.url --key-image second.png

    Blob Streams#

    csha blob-streams --help provides live encryption/decryption, device identities,
    direct TCP and a paired HTTP CONNECT relay. See Blob Streams
    for two-way communication examples and the C++ session API.

    Docker image commands#

    csha docker-image has keygen, pack, inspect, restore, load, and run
    commands. It streams a Docker-save archive into PNG pixels with a separate
    binary encryption key. See Docker images as PNGs for the
    complete workflow, available run options, and disk requirements.
    Modified at 2026-10-17 15:06:48
    Previous
    Building and installation
    Next
    Architecture
    Built with