dshbase

插件目录 / Developer / dsh-checkdigit

dsh-checkdigit

未验证 TYEclipse

✓ 持续维护

查看 GitHub ↗ ← 返回插件目录

1Stars
0Forks
0未关闭 issue
语言
2026-08-20最近推送
跨平台平台

功能简介

Check-digit mathematics toolbox for DeepSeek Harness (dsh): generate, validate and detect Luhn / Verhoeff / Damm / ISBN / EAN / UPC / ISIN / CUSIP / IBAN check digits — zero runtime dependencies

我们的评价
未验证 — 尚未实测

Check-digit mathematics toolbox for DeepSeek Harness (dsh): generate, validate and detect Luhn / Verhoeff / Damm / ISBN / EAN / UPC / ISIN / CUSIP / IBAN check digits — zero runtime dependencies 尚未验证——请自行安装测试。

「未验证」表示我们的自动化 CI 尚未安装过该插件。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。

你是插件作者? 想拿到「已验证」标签——提交你自己的验证证据(截图、日志或短视频),我们审核通过后即改为「已验证」。

提交验证证据 ↗

README

dsh-checkdigit

Check-digit mathematics toolbox for DeepSeek Harness (dsh): generate, validate and detect check digits for 11 schemes — Luhn, Verhoeff, Damm, ISBN-10, ISBN-13, EAN-8, EAN-13, UPC-A, ISIN, CUSIP and IBAN.

校验位数学工具箱:生成 / 验证 / 识别 11 种校验位(Luhn、Verhoeff、Damm、ISBN、EAN、UPC、ISIN、CUSIP、IBAN),零运行时依赖、纯本地算术。

Why

Language models routinely botch check-digit arithmetic: wrong card-number checksums, ISBNs that fail validation, IBANs with impossible check digits. Every algorithm here is implemented from its published specification with pure integer arithmetic — deterministic, offline, zero runtime dependencies — and cross-checked against published worked examples (Apple's US0378331005, the classic GB82 WEST 1234 5698 7654 32, the Luhn textbook example 79927398713, and more).

Install

dsh plugin --profile web add github:TYEclipse/dsh-checkdigit

Then add dsh-checkdigit to dsh.profile.bundles in your profile's package.json if it is not auto-activated, and restart dsh.

Tools

checkdigit_generate

Compute the check digit for a payload and return the complete identifier.

checkdigit_generate(scheme="luhn", payload="7992739871")
→ checkDigit: "3", complete: "79927398713"

Supported scheme values and their payloads:

scheme payload check digit example complete
luhn digits (any length ≥ 1) last digit 79927398713
verhoeff digits (any length ≥ 1) last digit 2363
damm digits (any length ≥ 1) last digit 5724
isbn10 9 digits 10th char (0-9 or X) 0306406152
isbn13 12 digits 13th digit 9780306406157
ean8 7 digits 8th digit 96385074
ean13 12 digits 13th digit 4006381333931
upca 11 digits 12th digit 036000291452
isin 2 letters + 9 alphanumerics 12th char (digit) US0378331005
cusip 8 chars from [A-Z0-9*@#] 9th char (digit) 037833100
iban 2-letter country + BBAN chars 3–4 (two digits) GB82WEST12345698765432

Use it to build test card numbers, ISBNs, barcodes, securities identifiers or account numbers whose check digits actually verify.

checkdigit_validate

Verify the check digit of a full identifier. The scheme is auto-detected when omitted (ISIN → CUSIP → IBAN → EAN-13 → UPC-A → EAN-8 → ISBN-10 → Luhn); pass scheme to force one.

checkdigit_validate(value="GB82WEST12345698765432")
→ valid: true, scheme: "iban", iban.country: "GB", iban.formatted: "GB82 WEST 1234 5698 7654 32"

checkdigit_validate(value="79927398714")
→ valid: false, scheme: "luhn", checkDigit: "4", expected: "3",
  detail: "Luhn: check digit should be 3, but the value ends in 4"

Spaces and dashes in the input are ignored. When a value is invalid, the result carries the expected check digit so callers can fix it programmatically.

checkdigit_info

Describe the supported schemes: identifier lengths, payload formats, check-digit positions and worked examples. Call with a scheme for one scheme, or without arguments for all 11.

Supported schemes

Scheme Standard Detail
Luhn ISO/IEC 7812 Credit/debit cards, IMEI, loyalty cards
Verhoeff Dihedral-group checksum; catches all single errors and adjacent transpositions
Damm Quasigroup operation; full-value tally must be zero
ISBN-10 ISO 2108 Mod-11; check digit may be X (= 10)
ISBN-13 ISO 2108 EAN-13 arithmetic (Bookland)
EAN-8 / EAN-13 GS1 GTIN-8 / GTIN-13 Retail barcodes
UPC-A GS1 GTIN-12 North American retail barcodes
ISIN ISO 6166 Securities; letters expand A=10…Z=35, then Luhn
CUSIP ANSI X9.6 North American securities; * @ # allowed; even positions doubled
IBAN ISO 13616 Mod-97 over letter-expanded rearranged string; BBAN length table for 75+ countries

Development

pnpm install
pnpm build
pnpm test   # 51 tests, anchors cross-checked against published worked examples
pnpm lint

License

MIT

安装

🧩 让 Agent 自动装(推荐)

装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:

dsh plugin add dshbase-catalog

然后对 agent 说「帮我装 dsh-checkdigit」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包

该插件是 GitHub 源码(未发 npm)——直接从仓库装:

Web profile:

dsh plugin --profile web add github:TYEclipse/dsh-checkdigit

Headless(CLI)profile:

dsh plugin --profile headless add github:TYEclipse/dsh-checkdigit

实测报告

尚未 L3 验证——若已跑过,见下方失败备注。

状态:pending · 最近测试 2026-08-26
备注:验证: runtime-fail 浏览全部待验证失败 →
安全:尚未扫描——我们的每日静态扫描将很快覆盖它。

分享徽章

Developer 里更多

浏览全部 7795 个插件 →