Create examples for implementation checks.
Initialising algorithm engine for Check Digit Test Vector Generator...
How Check Digit Test Vector Generator Works?
The Check Digit Test Vector Generator creates test inputs with known answers. Each set includes valid codes, deliberately broken codes and edge cases for the chosen algorithm. Use them to check an implementation.
- 1Select the algorithm and the number of vectors.
- 2Generate valid vectors from random or published payloads.
- 3Create invalid vectors by changing 1 digit or swapping 2 neighbours.
- 4Add edge cases: all zeros, maximum length, X or K results.
- 5Export the set as JSON, CSV, or code.
Check Digit Test Vector Generator Formula
The vector rule is Valid = payload + f(payload) and Invalid = mutate(Valid), where mutate makes a change the algorithm detects.
valid = p ‖ f(p)
invalid = p ‖ c', c' ≠ f(p)
edge = { 0…0, max length, special outputs }c'is a wrong check character.
Valid: 79927398713 Invalid (wrong check): 79927398714 Invalid (swap): 79927398731 Edge: 0000000000 → 0
Check Digit Test Vector Generator Conversion Table
The test vector table lists published reference vectors for 8 algorithms with a matching invalid vector.
| Algorithm | Payload | Expected check | Valid vector | Invalid vector |
|---|---|---|---|---|
| Luhn | 7992739871 | 3 | 79927398713 | 79927398714 |
| GS1 Mod 10 | 590123412345 | 7 | 5901234123457 | 5901234123458 |
| ISBN-10 | 080442957 | X | 080442957X | 0804429570 |
| Verhoeff | 236 | 3 | 2363 | 2364 |
| Damm | 572 | 4 | 5724 | 5725 |
| ISO 7064 MOD 11-2 | 079 | X | 079X | 0790 |
| ISO 7064 MOD 97-10 | 794 | 44 | 79444 | 79445 |
| ISO 7064 MOD 1271-36 | ISO79 | 3W | ISO793W | ISO790 |
What is Check Digit Test Vector Generator?
A Check Digit Test Vector Generator is a tool that creates known-answer test data for check digit implementations. Test vectors catch off-by-one errors, wrong weight directions, and mapping bugs.
Published reference vectors, such as the ISO 7064 annex examples and the Luhn sample 79927398713, anchor the tests to an external source.
What are the uses of Check Digit Test Vector Generator?
There are 3 main uses of the Check Digit Test Vector Generator, including unit tests, vendor acceptance, and regression suites.
- Unit tests: Developers paste vectors into test files.
- Vendor acceptance: Buyers test vendor software against known answers.
- Regression suites: Teams keep vectors to catch future breakage.