Skip to content
dmonakhovPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

Repository files navigation

paperark

Back up small, important data (keys, recovery documents, encrypted archives) to PAPER as QR codes, with a hard redundancy guarantee and a recovery path that does not depend on this software surviving.

paper + ark: the vessel that carries its contents through the flood.

Example backup

paperark example backup: a cover sheet beside a code page

Left: the cover sheet - a complete, human-readable recovery manual. Right: a code page - the QR codes, each labelled, over a footer that repeats the exact restore command, the file's SHA-256, and where to get the sources. Any single surviving page tells you how to read the backup back.

Status

Early development. The on-paper format is NOT frozen yet - do not use for real backups until v0.1.

Features

paperark is built so your data survives three independent failures: lost pages, lost software, and the passage of decades.

  • Restore from ANY K of N codes. Systematic Reed-Solomon spreads parity across the printed codes, so the file rebuilds from any K of the N - and the loss budget is stated in plain words on the artifact, not "print extra copies and hope".
  • Recovery never depends on paperark. The format specification and a ~400-line C89 reference decoder are printed ON the backup. Reading it back needs only a QR reader of the era (a $15 USB scanner works), a C compiler, and standard tools (sha256sum, gunzip, 7-Zip) - never this binary, never a package registry.
  • Restore with a scanner, a webcam, or just coreutils. A built-in QR decoder, a live USB-scanner mode, an external-decoder hook (zbar), and - printed in every page footer - a plain sort | base32 -d shell pipeline that needs no special software at all.
  • One static binary for backup and restore. Linux/macOS/Windows, QR decoding built in; no external scanner software to install.
  • Compact, deterministic output. A vector PDF, ~4.5 KB of data per A4 page, byte-identical for the same input.
  • Standard encryption, or bring your own. Optional --encrypt wraps the input in a stock 7z AES-256 container any 7-Zip opens; or hand paperark a blob you already encrypted with gpg or age.
  • A self-test you can trust. Every backup is decoded and must reconstruct - and at least 95% of its codes must read - before paperark reports success. A hard gate, on by default, that also builds and runs the printed C reference decoder when a compiler is present.

How to use

Make a backup

paperark encode docs/sample1.txt        # writes docs/sample1.txt.paperark.pdf

Print the PDF. The pile of paper in your hand is now a backup of the file. Every page is decoded and verified before it is written, so a backup that prints is a backup that restores. Store the sheets flat, dry, and dark, and keep 2-3 copies in separate places.

paperark encode demo

Encryption (--encrypt / --passgen), denser codes (--qr-version), and the printed C-decoder appendix (--archive) are all optional - run paperark encode -h for the full list.

Restore a backup

The restore process does not require paperark - any QR reader and a shell are enough. The easy way, if you have paperark, is to scan or photograph the pages and point it at the images:

paperark restore -o sample1.txt scans/*.png        # add --decrypt for an encrypted backup

paperark restore demo

For a headless host or a Raspberry Pi, a cheap USB barcode scanner works beautifully: it types each code to stdin, and paperark restore --interactive reads the stream live, stopping the instant it has enough codes to rebuild the file.

interactive USB-scanner restore demo

If paperark itself is gone, every page footer prints the exact coreutils command to rebuild the file, and the appendix carries the C reference decoder for damaged scans. See docs/recovery.md for every recovery path in detail - from the binary down to coreutils-only.

How it works

The input blob (optionally a 7z-AES container) is split into K data shards, extended with M parity shards (systematic Reed-Solomon over GF(256), any K of N recover), and each shard becomes one QR code carrying a single text line: PA1:<DOCID>:G<GRP>.<NGRP>:<D|P|M><IDX>.<CNT>:<CRC32>:<BASE32-PAYLOAD>. The line uses only scanner-safe characters, so any QR reader in any era returns clean text. Per-shard CRC32 (over header fields AND payload) converts damage into located erasures, which is what makes a small erasure-only decoder sufficient. DOCID is the first 8 hex chars of SHA-256 of the blob, so the recovered file self-verifies against the id stamped on every sheet, copies of the same document pool their scans at restore time, and output is fully deterministic. Pages carry a cover sheet with the complete restore procedure, shuffled/interleaved codes so a lost page spreads thin, and an optional appendix with the format spec and the reference decoder (as checksummed source text and as QR codes).

For the full specification, see docs/design-v1.0.md.

License

MIT. See LICENSE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages