csha, not a packaged SDK. Examples here assume the CSha source tree isCXX_EXTENSIONS OFF on consumingproject() call; the subdirectory cannot change an already selected compiler.cmake -S . -B build -G Ninja \
-DCMAKE_CXX_COMPILER="$(brew --prefix llvm)/bin/clang++" \
-DCMAKE_OSX_SYSROOT="$(xcrun --show-sdk-path)"
cmake --build build --target roundtrip
./build/roundtrip-DCMAKE_CXX_COMPILER=clang++;roundtrip.cpp. The example demonstrates explicit AES settings,roundtripRecovered 11 bytes in addition to library diagnostics.std::string as a byte container; write data() and size() to aCSha.h and link csha_core.| Method | Inputs and result |
|---|---|
encode_aes(data, key, mode, derive, cipher) | Returns an encrypted cv::Mat |
decode_aes(image, password, key, mode, derive) | Returns recovered bytes as std::string; ordinary AES uses the key input |
encode_zip(path, key, mode, derive, cipher) | Reads an archive, Base64-wraps it, and returns an encrypted image |
decode_zip(image, password, output, key, mode, derive) | Restores archive bytes to a file |
generate_map(seeds, mc_version) | Returns a biome map with embedded seed metadata |
extract_seeds_from_map(image) | Returns std::vector<SeedData> |
image_to_seed(image, salt, gen_seed) | Hashes image content when gen_seed is true, otherwise reads metadata |
generate_env_map(data, password, key, mode, derive, cipher) | Returns a map containing encrypted data |
decode_env_map(image, password, key, mode, derive) | Recovers the map payload using matching settings |
embed_png_text(bytes, keyword, text) | Adds a PNG text chunk and returns PNG bytes |
extract_png_text(bytes, keyword) | Reads a PNG text chunk; returns empty when absent |
cipher defaults to csha::crypto::Cipher::AES. Pass, forCipher::ChaCha20Poly1305 to select another algorithm; decoders detectSeedData contains world_seed, hex, mc_version, spawn_x, and spawn_z.encode_sha / decode_sha support the legacy SHA representation/verificationcsha_core:cv::imread's default@filename shorthand. Filestreams/blob_stream.h and link csha_blob_streams.generate_identity() returns a local private PEM and public certificate PEM;fingerprint(certificate) returns the identity fingerprint to verify with theSession(Role, Identity, trusted_peer_certificate) only after| Method | Caller responsibility |
|---|---|
ready() | Wait until handshake completion before sending plaintext |
receive(data, size) | Feed ordered ciphertext in chunks no larger than 16 KiB |
send(data, size) | Supply at most 16 KiB of plaintext per call |
take_ciphertext() | Drain and forward handshake, data, and shutdown bytes |
take_plaintext() | Drain authenticated received bytes |
finish() | End local sending; keep forwarding output and receiving peer data |
peer_finished() / local_finished() | Track independent directional completion |
transport_eof() | Validate that a transport close follows authenticated shutdown |
docker/image_archive.h and link csha_docker_image.Key is std::array<unsigned char, 32>. generate_key() creates a key.encode_archive(tar_fd, png_fd, key, image_id, reference, cipher) anddecode_archive(png_fd, tar_fd, key) return Info with the image ID, reference,-1 as the output archive descriptor to verify without retaining plaintext.src/crypto/encoder.ixx exports the C++20 module csha.encoder, includingCipher, EncoderConfig, Encoder, and StreamingEncoder. Linkcsha_ciphers for the cipher implementations, or csha_core for the factorycrypto/encoder_factory.h to callcsha::crypto::make_encoder(config); that header imports the module.config.mode = AESMode::GCM explicitly for authenticated AES: the lower-levelEncoder::encode producesEncoder::decode returns a string containing theprocess as provisional untilverify succeeds. finish produces the encryption tag. These operations areheler.h declares int csha::run_cli(int argc, char* argv[]). It belongs to themain.cpp. It is not the embeddinggetopt state, writes to standard streams, andexit. Library consumers should call the modules