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

    Encryption algorithms

    csha --list-ciphers lists AES plus ten additional authenticated cipher options.
    Use --cipher NAME when generating an encrypted image, environment map,
    image-pair map, or Docker PNG. Decoding reads the stored algorithm automatically.
    CLI nameConstructionKey bitsNonce bytes
    aesExisting AES CBC, CTR, or GCM; Docker uses GCM256Existing format
    chacha20-poly1305IETF ChaCha20 with Poly130525612
    xchacha20-poly1305XChaCha20 with Poly130525624
    camellia-eaxCamellia in EAX mode25616
    aria-eaxARIA in EAX mode25616
    twofish-eaxTwofish in EAX mode25616
    serpent-eaxSerpent in EAX mode25616
    cast256-eaxCAST-256 in EAX mode25616
    rc6-eaxRC6 in EAX mode25616
    mars-eaxMARS in EAX mode25616
    sm4-eaxSM4 in EAX mode12816
    These are ten cipher choices, including two variants of the ChaCha family.
    Implementations come from Crypto++ 8.9 or later and share the C++20
    csha.encoder interface in src/crypto/encoder.ixx. EAX supplies authentication
    for the block ciphers; all ten use 16-byte authentication tags. ChaCha20-Poly1305
    is the default recommendation when choosing a non-AES option. The algorithms
    have different performance, interoperability, and deployment histories; this
    list is not a claim that each is interchangeable in external protocols.
    # Encrypt text into PNG pixels, then recover it without specifying the cipher.
    csha -M es -s 'hello' -p 'your secret phrase' \
      --cipher chacha20-poly1305 -o message.png
    csha -M di -i message.png -p 'your secret phrase'
    
    # A file or ZIP, including Base64 PNG URL output.
    csha -M ef -f input.bin -p 'your secret phrase' \
      --cipher twofish-eax -o file.png --data-url-output file.url
    csha -M ez -z input.zip -p 'your secret phrase' --cipher serpent-eax -o zip.png
    csha -M dz -i zip.png -p 'your secret phrase' -Z recovered.zip
    
    # Either user image can unlock the map; key wrapping uses the selected cipher too.
    csha -M f -f input.bin --key-image first.png --key-image second.png \
      --cipher xchacha20-poly1305 -o pair.png
    csha -M fd -i pair.png --key-image second.png -o recovered.bin
    
    # Docker archives keep the existing streaming, verify-before-load workflow.
    csha docker-image keygen --output app.docker-key
    csha docker-image pack --image my-app:latest --cipher camellia-eax \
      --key-file app.docker-key --output app.png
    csha docker-image run --input app.png --key-file app.docker-key
    For password-based images, new ciphers use PBKDF2-HMAC-SHA256 with a fresh
    16-byte salt and 600,000 iterations. They require a nonempty -p value. -A
    is specific to AES, and the legacy DIRECT and FIXED key derivations are
    rejected with a new cipher. Image-pair credentials and Docker keys already
    provide key bytes, so those paths do not use a password KDF. SM4 uses 16 bytes
    of the supplied or derived 32-byte material.
    AES remains the default. Existing AES image, pair-map and Docker formats remain
    readable, and default AES outputs retain their old formats. New cipher images
    and pair maps use separate format markers; non-AES Docker PNGs use a version-2
    header. Old binaries cannot decode the new formats. New pair maps hold up to
    196,288 plaintext bytes; existing AES pair maps hold 196,432 bytes.
    Cipher identity, envelope length, nonce and password-derivation parameters are
    authenticated. Unknown IDs, unsupported parameters, wrong keys, and modified
    payloads fail. The password envelope has a 64-byte header plus a 16-byte tag.
    Image and ZIP processing remains in memory; Docker archives remain streamed.
    Blob Streams continues to use its TLS 1.3 AES-GCM transport. The ten cipher
    options here apply to stored data and do not replace TLS with a custom protocol.
    These algorithms provide encryption, not language translation or a lossy JPEG
    recovery scheme. Preserve PNG pixel values exactly.
    Implementation references: Crypto++ authenticated cipher API,
    Crypto++ EAX, and
    RFC 8439.
    Modified at 2026-10-16 04:45:45
    Previous
    Troubleshooting
    Next
    Testing
    Built with