API — Configuration

{
  "version": "1",
  "fmt":   { "export": "hex" },          // 'bytes' | 'hex' | 'base64'
  "sign":  {
    "N": 5,                              // integer ≥ 2
    "mode": "S",                         // 'S' | 'X'
    "hash": "SHA-256",                   // built-in or custom ID
    "originSize": 256,                   // bits; in X-mode == digest length
    "pack": "simpleSig",                 // reserved for future layouts

    /* custom digest (optional) */
    "func": null,                        // async (Uint8Array) => Uint8Array | string
    "output": "bytes",                   // 'bytes' | 'hex' | 'base64'
    "size": null,                        // digest length (bits), recommended
    "cdn": null                          // URL to lazy-load a hasher
  },

  /* bulk registration of multiple custom hashers */
  "externalHashers": { }
}

Built-in hash IDs

"SHA-1", "SHA-256", "SHA-384", "SHA-512", "SHA3-256", "SHA3-512", "BLAKE3", "WHIRLPOOL".

Validation rules

  • X-mode requires originSize == digestLength(hash).
  • Custom hashers must declare at least func or cdn, plus output.
    Declaring size is strongly recommended (enforced at runtime).

Common errors (thrown)

  • Hasher <id> not registered — unknown hash ID or missing descriptor.
  • Hasher <id> size mismatch — digest output length differs from size.
  • Unsupported output <fmt>output not in {bytes, hex, base64}.

verify() never throws; it returns false for integrity mismatches.