--- name: crypto-utils description: Use when implementing or debugging code that uses @suaveplan/crypto-utils: Shared cryptographic utilities: encoding (hex/base64/base64url/base58), byte helpers (concat/xor/i2osp/os2ip), constant-time equality, random bytes, zeroize, Merkle tree helpers, KAT/differential-fuzz test harnesses, PrimitiveId registry, PrimitiveNotImplemented error. --- # @suaveplan/crypto-utils Shared cryptographic utilities consumed internally by all other `@suaveplan/crypto-*` packages. Provides the low-level primitives that every crypto implementation needs but that belong in one place: multi-alphabet encoding (`toHex`/`fromHex`, `toBase64`/`fromBase64`, `toBase64Url`, `toBase58`/`fromBase58`); byte helpers (`concatBytes`, `xor`, `i2osp`/`os2ip` for integer-to-octet-string conversions); `constantTimeEqual` for timing-safe comparisons; `randomBytes` with an injectable `ByteSource`; `zeroize` for wiping key material; Merkle tree helpers (`merkleRoot`, `merkleProof`, `verifyMerkleProof`); a `PrimitiveId` registry and `PrimitiveNotImplemented` sentinel error; and KAT/differential-fuzz harnesses (`runVectors`, `diffFuzz`) used in every crypto primitive's test suite. Zero runtime crypto dependencies — this package provides helpers only, not cryptographic algorithms. Application code should generally import from `@suaveplan/crypto` or `@suaveplan/crypto-hash`; import from this package only when building a new cryptographic primitive or engine adapter. ## When to use this skill - Implementing or debugging code that imports `@suaveplan/crypto-utils`. - The task touches: see package README. - You need API guidance for this package's exports. ## Quick reference ```ts import { /* see API Reference below */ } from "@suaveplan/crypto-utils"; ``` ## Dependencies Workspace dependencies: `@suaveplan/bytes`, `@suaveplan/error`, `@suaveplan/types` ## Where to read more This skill is intentionally short. The package's own documentation is the authoritative source — read these in order: 1. **`packages/crypto/crypto-utils/README.md`** — overview, install, quick-start, module index 2. **`packages/crypto/crypto-utils/src/**/*.md`** — co-located docs per implementation file (Purpose, Features, Basic + Advanced examples, full API reference, Implementation notes — all packages ship ≥200 words per module) 3. **`packages/crypto/crypto-utils/package.json`** `exports` map — every subpath you can import from When the user asks an API question, read the relevant co-located `.md` first; do not answer from training-data memory. ## See also - `@suaveplan/bytes` - `@suaveplan/error` - `@suaveplan/types` --- _This SKILL.md is auto-generated by `suaveplan-skills/scripts/generate-skills.ts` from the package's README. Do not edit by hand — re-run the generator after the README changes._