splitjoin — split and rejoin files with checksums
splitjoin is a LightGUI front-end for the splitjoin command-line utility from util_box. It splits a file into N MB chunks and rejoins it from a manifest with checksums. It is one of the 285 apps in util_boxgui, the project recreating util_box utilities as LightGUI apps, each with a screenshot and a walkthrough on the matching LightGUI doc site. The full source is apps/c/splitjoin/splitjoin.cpp in that repo.
Chunking a file is easy; trusting the rejoin is the hard part. A corrupt chunk that slips through silently corrupts the output, and the output looks fine until something downstream fails on it. The manifest is what makes the rejoin trustworthy: it carries the original file's hash and one hash per chunk, so the join can verify every chunk before writing a byte, reassemble the file, and then verify the reassembled file against the original hash. The demo in this app runs the whole round-trip on launch — split, join, and a tamper test — so every step is visible on screen instead of buried in a log.
The GUI layout

The app auto-runs its core action on launch — no input needed — and shows every step, in a window holding six widgets, all placed by hand in code. There is no designer file, and that is deliberate: the app is written the way the LightGUI designer's generated apps are structured, so the code below reads like generated output with the split/join logic swapped in.
- Source and manifest lines (top): the demo file (
/tmp/splitjoin-demo/data.bin, 5,242,880 bytes), the 1 MB chunk size, the 5 chunks produced, and the manifest path plus the original file's SHA-256. - Chunk table (middle): a
TListViewwith one row per chunk — index, file name (data.bin.part000through.part004), size in bytes, SHA-256, and verification status (OKonce the join has verified it). The demo data is periodic (bytei = (i*7) & 0xff, the same pattern as the CLI's--selftest), so all five 1 MiB chunks have identical content — and therefore identical hashes. That is correct, not a copy error: the last chunk is a full 1,048,576 bytes too, because 5 MiB divides evenly into five 1 MiB chunks. - Join result (below the table):
all 5 chunk(s) verified OKand confirmation that the reassembled file's SHA-256 matches the original — the CLI's pre-write check plus its post-join check, as displayed lines instead of printed ones. - Tamper test (below that): the CLI selftest's second half — one chunk (
data.bin.part002) is corrupted with an extra byte and the join is re-attempted. It must refuse withCHECKSUM FAIL; the label reports the rejection. - Re-run demo button: repeats the whole round-trip (split, join, tamper test) from scratch. The split overwrites the corrupted chunk, so a re-run always starts clean. Status line (bottom): time of the last run.
The manifest
The manifest is a plain text file: a header line with the original file, chunk size, chunk count, and original hash, then one line per chunk with its index, file name, byte size, and SHA-256. The demo's manifest, with the hash values shown as placeholders here, reads:
# splitjoin v1 file=data.bin size=5242880 chunks=5 sha256=<original>
0 data.bin.part000 1048576 <sha256>
1 data.bin.part001 1048576 <sha256>
2 data.bin.part002 1048576 <sha256>
3 data.bin.part003 1048576 <sha256>
4 data.bin.part004 1048576 <sha256>The header's chunk count is the promise the join holds the file to: five chunks in, five chunks out, and the original hash at the end. The pre-write check is the part that makes the promise safe. The join verifies every chunk's checksum before writing a byte, so a bad chunk is caught while the output file still does not exist — there is no partial output to clean up, and no chance of a half-written file being mistaken for a complete one. The empty-file case is ported too, the same as the CLI: an empty file produces one empty .part000 chunk, so the manifest always has at least one line and the join always has something to verify.
The source
The split/join logic is a direct port of src/splitjoin.c from util_box, including the CLI's own self-contained SHA-256 implementation, copied verbatim. Split hashes the source file, writes the .partNNN files plus the manifest, and the empty-file case is ported in the code, the same as the CLI — an empty file produces one empty .part000 chunk. Join parses the manifest, verifies every chunk's checksum before writing a byte, reassembles, then verifies the reassembled file against the original hash. A missing or corrupted chunk is reported by name and no output is written — the GUI's tamper test demonstrates this. Every step is also echoed to stdout in the CLI's own wording (split … into 5 chunk(s) …, all 5 chunk(s) verified OK, joined 5 chunk(s) -> … sha256 verified, tamper test: CHECKSUM FAIL …), so the GUI numbers can be checked against splitjoin split / splitjoin join directly.
The differences from the CLI are the usual ones for a demo app. The GUI has no --size / --out options — fixed demo: 5 MiB file, 1 MB chunks, fixed /tmp/splitjoin-demo/ paths — and no --selftest flag. The demo is the selftest, run on every launch: split, join, and tamper rejection, all visible on screen.
Building and running it
g++ -std=c++17 -I/root/lg-review/lightgui/widgets/components -I/root/lg-review/lightgui/widgets -O2 -Wall splitjoin.cpp -lX11 -o build/splitjoinThat is the one g++ line from the Makefile — make runs it. It builds clean with no warnings, and needs g++, libx11-dev, and the LightGUI checkout (header-only widgets on raw X11). Under a real X server, or under Xvfb:
Xvfb :205 -screen 0 1024x768x24 &
DISPLAY=:205 ./build/splitjoinThe demo writes to /tmp/splitjoin-demo/ — the data file, the out/ parts and manifest, and joined.bin — and re-running overwrites it. The CLI equivalents are:
splitjoin split data.bin --size 1 --out out
splitjoin join out/data.bin.manifest --out joined.binVerified against the CLI
Verified against the CLI binary on the same box, splitting the identical 5 MiB demo file with --size 1: 11/11 checks pass. The manifests are byte-identical (diff, GUI against CLI); the chunk count is 5 in both; all chunk sizes match (5 × 1,048,576 bytes); all chunk SHA-256 values match; the manifest header fields match (file, size, chunks, original sha256); the GUI joined.bin SHA-256 equals the original file's SHA-256; the CLI joined output SHA-256 equals the original file's SHA-256; the GUI joined.bin is byte-identical to the CLI joined output (cmp); the GUI tamper test rejected the corrupted chunk (CHECKSUM FAIL chunk data.bin.part002); the CLI join rejects the same tampered chunk with a non-zero exit and the same message; and the GUI stdout split/join lines match the CLI's stdout, path-normalized. See the util_boxgui repo for the other 284 apps.