# Crc parametric compute

`crc-parametric-compute` · version 1.0.0 · Hashing & signatures · free, no key needed

Compute a CRC using a named catalogue preset (CRC-8, CRC-16/ARC, CRC-32/ISO-HDLC, ...) or an explicit Rocksoft model.

**Use when you need to: crc16 modbus checksum · crc32c of this data · xmodem crc of a packet.**

## Decide before calling

Read the [versioned contract](/v1/tools/crc-parametric-compute/versions/1.0.0) and the supported scope below. Reuse `crc-parametric-compute@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `crc-parametric-compute@1.0.0` for crc16 modbus checksum. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- crc16 modbus checksum
- crc32c of this data
- xmodem crc of a packet
- compute crc with custom polynomial
- kermit crc for this string
- what is the crc-32 bzip2 checksum
- בדוק CRC פרמטרי מותאם אישית

## Not supported

- CRC widths other than 8, 16, 32 or 64 (e.g. CRC-12, CRC-24)
- catalogue presets outside the 12 pinned names (supply an explicit model for any other published variant)

## Behavior

- Exactly one of preset or model must be given; both or neither is invalid_input.
- preset resolves to one of 12 fixed parameter sets; model lets the caller supply width (8, 16, 32 or 64) and poly/init/xorout directly as case-insensitive hex strings (1 to 16 digits, no "0x" prefix). A poly/init/xorout value that does not fit in width bits is invalid_input.
- Algorithm (Rocksoft parametrised model, Ross N. Williams): initialize register R = init masked to width bits. For each input byte b: if refin, reverse its bits within 8 bits; inject it at the top of the register and shift 8 times, XORing in poly whenever the top bit is set (masked to width bits after every step). After all bytes: if refout, reflect the entire width-bit register once (not per byte). Finally R = R XOR xorout, masked to width bits.
- hex and check are zero-padded to ceil(width/4) lowercase hex digits; decimal is the unsigned base-10 string of the same value.
- check is the algorithm above applied to the fixed 9-byte ASCII input "123456789" using the resolved model, independent of the caller's text -- the same "check" value published CRC catalogues use to confirm a model or implementation.
- model in the output always echoes the fully resolved parameters as lowercase hex with no leading-zero padding beyond the minimal digits needed to represent the value (so a preset's "00" init is echoed as "0"), whether the caller supplied preset or model.
- Disclaimer: format transform only; provides no confidentiality, integrity, or authenticity.

## Input

- `text` (string, required): max length 262144
- `input_encoding` (one of "utf8", "hex", "base64", "base64url", optional): default `"utf8"`
- `preset` (one of "crc-8", "crc-16/arc", "crc-16/ibm-3740", "crc-16/xmodem", "crc-16/kermit", "crc-16/modbus", "crc-32/iso-hdlc", "crc-32c", "crc-32/bzip2", "crc-32/mpeg-2", "crc-64/ecma-182", "crc-64/xz", optional)
- `model` (object, optional)

## Output

- `width` (one of 8, 16, 32, 64, required)
- `model` (object, required)
- `hex` (string, required): pattern `^[0-9a-f]+$`
- `decimal` (string, required): pattern `^(0|[1-9][0-9]*)$`
- `check` (string, required): pattern `^[0-9a-f]+$`

## Limits

- max input bytes: 16384

## Example

Request input:

```json
{
  "text": "123456789",
  "preset": "crc-32/iso-hdlc"
}
```

Response:

```json
{
  "result": {
    "width": 32,
    "model": {
      "width": 32,
      "poly": "4c11db7",
      "init": "ffffffff",
      "refin": true,
      "refout": true,
      "xorout": "ffffffff"
    },
    "hex": "cbf43926",
    "decimal": "3421780262",
    "check": "cbf43926"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "crc-parametric-compute",
  "version": "1.0.0",
  "input": {
    "text": "123456789",
    "preset": "crc-32/iso-hdlc"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/crc-parametric-compute/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"text":"123456789","preset":"crc-32/iso-hdlc"}'
```

The machine-readable contract is at [/v1/tools/crc-parametric-compute/versions/1.0.0](/v1/tools/crc-parametric-compute/versions/1.0.0).

### CLI

```sh
node cli.mjs run crc-parametric-compute 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Hash digest compute](/tools/hash-digest-compute): Compute a message digest (SHA-2, SHA-3, BLAKE2/3, MD5, RIPEMD-160, Keccak-256) over encoded input bytes.
- [Git object id compute](/tools/git-object-id-compute): Compute the Git object id git itself would give a blob, tree, commit or tag under Git's exact object framing.
- [Hash noncrypto compute](/tools/hash-noncrypto-compute): Compute FNV-1/1a, MurmurHash3 or xxHash over encoded input bytes, with an optional seed for algorithms that take one.
- [Ipfs cid compute](/tools/ipfs-cid-compute): Compute the CIDv0, CIDv1 dag-pb and CIDv1 raw content identifiers 'ipfs add' would give a single-chunk file.
- [Hash digest verify](/tools/hash-digest-verify): Recompute a fixed-length digest over encoded input bytes and compare it to an expected digest given in any encoding.
- [Hmac compute](/tools/hmac-compute): Compute HMAC-SHA256/SHA512/MD5/SHA-1/SHA-3/RIPEMD-160 (RFC 2104) over encoded key and message bytes.
