Commit Graph

8 Commits

Author SHA1 Message Date
NikitolProject
4077847caa feat(12-02): wire salt into pack/unpack, update main.rs, add password tests
- Pack signature accepts optional salt, writes 16-byte salt between header and TOC
- Set flags bit 4 and adjust toc_offset to 56 when salt present
- read_archive_metadata returns salt alongside header and TOC entries
- Add read_archive_salt() public helper for pre-unpack salt reading
- main.rs uses resolve_key_for_pack/resolve_key_for_unpack for two-phase password flow
- Add 5 new integration tests: password roundtrip, wrong password rejection,
  salt flag presence, no-salt flag for key archives, directory password roundtrip
- All 52 tests pass (25 unit + 7 golden + 20 integration)
2026-02-27 00:01:23 +03:00
NikitolProject
acff31b0f8 feat(12-01): add CLI key args and refactor archive functions for user-specified keys
- Add hex dependency for --key hex decoding
- Add KeyArgs (--key, --key-file, --password) as clap arg group on top-level CLI
- Replace hardcoded KEY constant with resolve_key() supporting hex and file sources
- Refactor pack/unpack to require key parameter, inspect accepts optional key
- Wire CLI key resolution to archive functions in main.rs
- Inspect works without key (header only) or with key (full TOC listing)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 23:50:39 +03:00
NikitolProject
52ff9ec3b7 perf: parallelize pack and unpack with rayon
Some checks failed
CI / test (push) Failing after 40s
Pack changes:
- Split into path-collection (sequential) + crypto-processing (parallel)
- Introduce CollectedEntry enum to separate directory walk from file processing
- process_file() now creates thread-local RNG instead of taking &mut Rng
- File entries processed via rayon into_par_iter(), preserving deterministic order

Unpack changes:
- Phase 1: Sequential read of all ciphertexts from archive (single file handle)
- Phase 2: Create all directories sequentially (parent-before-child ordering)
- Phase 3: Parallel verify/decrypt/decompress/write via rayon par_iter
- Phase 4: Sequential result reporting for deterministic output
- Collect results into Vec<UnpackResult> to avoid interleaved stdout/stderr
2026-02-26 23:07:04 +03:00
NikitolProject
7820c18622 feat(08-01): add directory support to pack/unpack/inspect
- Implement collect_entries() with recursive directory traversal (DFS preorder)
- pack() handles mixed file and directory arguments with relative paths
- Directory entries stored with entry_type=1, zero-length crypto fields
- unpack() creates directory hierarchy and restores Unix mode bits
- inspect() displays entry type (dir/file) and octal permissions
- Update cli.rs doc comments for directory support

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 21:47:15 +03:00
NikitolProject
4e25d19ff5 feat(08-01): update format.rs for v1.1 TOC entry layout
- Bump VERSION constant from 1 to 2
- Add entry_type (u8) and permissions (u16) fields to TocEntry struct
- Update write_toc_entry/read_toc_entry for new field order after name
- Update entry_size formula from 101 to 104 + name_length
- Update all unit tests for v1.1 layout (new fields, version 2, sizes)
- Add placeholder entry_type/permissions to archive.rs ProcessedFile for compilation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 21:45:20 +03:00
NikitolProject
b6fa51d9fd feat(06-01): implement full obfuscation pipeline in archive.rs
- pack(): generate decoy padding (64-4096 random bytes per file)
- pack(): encrypt serialized TOC with AES-256-CBC using random toc_iv
- pack(): XOR header buffer before writing (8-byte cyclic key)
- pack(): set flags bits 1-3 (0x0E) for all obfuscation features
- unpack(): XOR bootstrapping via read_header_auto()
- unpack(): decrypt TOC when flags bit 1 is set
- inspect(): full de-obfuscation via shared read_archive_metadata()
- Factor out read_archive_metadata() helper for unpack/inspect reuse
- All existing tests pass (unit, golden, round-trip integration)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 02:19:48 +03:00
NikitolProject
be507070b6 feat(02-02): implement pack, unpack, and inspect archive commands
- pack: two-pass algorithm reads/hashes/compresses/encrypts files then writes header+TOC+data
- inspect: reads header and TOC, displays all metadata (sizes, offsets, IVs, HMACs, SHA-256)
- unpack: HMAC-first verification, AES-256-CBC decryption, optional gzip decompression, SHA-256 check
- CLI dispatch wired from main.rs to archive module
- Directory traversal protection: rejects filenames starting with / or containing ..
- Compression auto-detection: .apk/.zip/etc stored without gzip (flags=0x00 when no file compressed)
- Round-trip verified: pack+unpack produces byte-identical files
- HMAC tamper detection verified: flipped ciphertext byte triggers rejection

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 00:03:28 +03:00
NikitolProject
c647f3a90e feat(02-01): project scaffolding with Cargo, CLI skeleton, and key module
- Initialize Rust project with aes, cbc, hmac, sha2, flate2, clap, rand, anyhow dependencies
- Add clap derive CLI with pack/unpack/inspect subcommands
- Add hardcoded 32-byte AES-256 key constant
- Create stub modules for format, crypto, compression, archive
- All 7 source files in place, cargo build succeeds

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 23:56:09 +03:00