pmarreck

Par2z — Development skill for Claude Code

Development community

A cleanroom reimplementation of the par2 error-correction algorithm, library and cli in Zig, based only on publicly-available specs (NOT its source code), and with a more permissive license, a C ABI w.

How to install Par2z

This entry records only its repository, not the path inside it, so there is no exact command to give. Open pmarreck/par2z and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Par2z does

A cleanroom reimplementation of the par2 error-correction algorithm, library and cli in Zig, based only on publicly-available specs (NOT its source code), and with a more permissive license, a C ABI wrapper, and a LuaJIT FFI example. Full test coverage. NOTE: gpt-5.2-codex and Claude Opus 4.5 AI assisted in parts.

Alternatives in Development

  • Correction Handler — Correction 处理 Prompt 24k ★
  • JWT Scan — JWT attack toolkit (offline) — alg:none forgery, RS256→HS256 algorithm confusion, weak-secret crack, static cl 4.5k ★
  • Fidelity — Measure how faithfully a clone reproduces a site — pixel-diff plus motion-fidelity into one 0-100 score, a let 3.6k ★

README

par2z

[![Garnix](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgarnix.io%2Fapi%2Fbadges%2Fpmarreck%2Fpar2z)](https://garnix.io/repo/pmarreck/par2z) [![CI](https://github.com/pmarreck/par2z/actions/workflows/ci.yml/badge.svg)](https://github.com/pmarreck/par2z/actions/workflows/ci.yml)

Overview

Cleanroom PAR2 implementation with a Zig core, C ABI for FFI (Swift/LuaJIT), and a standalone CLI.

API Layers

  • High-level recovery/verification API in src/core/api.zig.
  • Block-level API in src/core/block_api.zig for slice-by-slice workflows and custom storage backends.
  • Storage adapters in src/core/storage.zig (memory-backed and file-backed) so recovery can run without loading whole files up front.
  • CLI operations moved into src/ops.zig (callable from Zig and suitable for C/Swift wrappers). src/cli.zig is now a thin CLI parser + I/O shim.

C API Examples

The C ABI is declared in `include/par2.h`. Memory and stream inputs do not touch disk.

Thread pool configuration (optional): the library uses a global thread pool by default. You can configure the global pool size or supply your own pool handle via the C ABI. Handles are independent and safe to run concurrently. The only shared global state is the thread pool configuration, so set or swap pools before starting work and avoid changing it while operations are active.

Create from memory (no temp files), write `.par2` to a path:

#include "par2.h"

const uint8_t data[] = {0,1,2,3,4,5,6,7};
Par2CreateHandle *create = NULL;
par2_create_new(NULL, &create);
par2_create_add_memory(create, "data.bin", data, sizeof(data));
par2_create_set_output_path(create, "set.par2");
par2_create_run(create);
par2_create_destroy(create);

// optional: configure global pool size (0 = default)
par2_thread_pool_configure(0);

Verify from in-memory PAR2 bytes and a stream input:

#include "par2.h"

struct MemCtx { const uint8_t *data; size_t len; };
static size_t read_at(void *ctx, uint64_t off, uint8_t *o