Checkdigit compute
checkdigit-compute · version 1.0.0 · Identifiers & check digits · free, no key needed
Compute the check digit(s) for a payload under a named algorithm (Luhn, Verhoeff, Damm, ISO 7064, GS1, mod 10).
Use when you need to: compute a luhn check digit · calculate iso 7064 check digits · verhoeff check digit calculator.
Decide before calling
Read the versioned contract and the supported scope below. Reuse checkdigit-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 checkdigit-compute@1.0.0 for compute a luhn check digit. 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
- compute a luhn check digit
- calculate iso 7064 check digits
- verhoeff check digit calculator
- gs1 check digit for a barcode payload
- damm algorithm check digit
- mod 97 check digits for an identifier payload
- swiss mod 10 recursive check digit
- חישוב ספרת ביקורת
Not supported
- validating a full value that already has a check digit attached (use checkdigit-validate)
- identifier-specific structure such as IBAN country rules, ISIN prefixes, or GS1 key lengths
- lowercase payload letters or separators such as spaces or hyphens
Behavior
- payload must match ^[0-9A-Z]+$ (uppercase ASCII digits and letters only, 1-64 characters); lowercase letters, separators, or any other character throw invalid_input before any algorithm-specific check runs.
- Per-algorithm payload alphabet: luhn, verhoeff, damm, gs1-mod10, mod10-recursive, iso7064-mod11-2 and iso7064-mod11-10 accept decimal digits 0-9 only. iso7064-mod661-26 accepts letters A-Z only. iso7064-mod37-2, iso7064-mod37-36, iso7064-mod97-10 and iso7064-mod1271-36 accept digits 0-9 and letters A-Z. A payload character outside the named algorithm's alphabet throws invalid_input.
- full = payload concatenated with check_digits, in that order; no separators and no rearrangement.
- Pure arithmetic on the payload string; no locale, clock, or randomness; identical output across runs for the same input.
Input
payload(string, required): min length 1; max length 64; pattern^[0-9A-Z]+$algorithm(one of "luhn", "verhoeff", "damm", "iso7064-mod11-2", "iso7064-mod11-10", "iso7064-mod37-2", "iso7064-mod37-36", "iso7064-mod97-10", "iso7064-mod661-26", "iso7064-mod1271-36", "gs1-mod10", "mod10-recursive", required)
Output
check_digits(string, required): min length 1; max length 2; pattern^[0-9A-Z*]{1,2}$full(string, required): min length 2; max length 66; pattern^[0-9A-Z*]+$algorithm(one of "luhn", "verhoeff", "damm", "iso7064-mod11-2", "iso7064-mod11-10", "iso7064-mod37-2", "iso7064-mod37-36", "iso7064-mod97-10", "iso7064-mod661-26", "iso7064-mod1271-36", "gs1-mod10", "mod10-recursive", required)
Limits
- max payload bytes: 64
Example
Request input:
{
"payload": "411111111111111",
"algorithm": "luhn"
}
Response:
{
"result": {
"check_digits": "1",
"full": "4111111111111111",
"algorithm": "luhn"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "checkdigit-compute",
"version": "1.0.0",
"input": {
"payload": "411111111111111",
"algorithm": "luhn"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/checkdigit-compute/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"payload":"411111111111111","algorithm":"luhn"}'
The machine-readable contract is at /v1/tools/checkdigit-compute/versions/1.0.0.
CLI
node cli.mjs run checkdigit-compute 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Checkdigit validate: Validate a full value's trailing check digit(s) against a named algorithm (Luhn, Verhoeff, Damm, ISO 7064, GS1, mod 10).
- Gs1 key validate: Validate a GTIN-8/12/13/14, GLN, SSCC or GSIN's GS1 mod-10 check digit and look up its 3-digit GS1 prefix meaning.
- Upu s10 validate: Validate a 13-char UPU S10 postal identifier's weighted mod-11 check digit, split service indicator and country.
- Iccid validate: Validate a 19/20-digit ICCID's Luhn check digit, require the 89 major industry id, split issuer/account digits.
- Imo number validate: Validate a 7-digit IMO ship identification number's weighted mod-10 check digit, with or without the 'IMO ' prefix.
- Iso6346 container validate: Validate an 11-character ISO 6346 container number's mod-11 check digit and split the owner code, category and serial.