Repository navigation
Implement the aba, verhoeff, and damm identifier validators - #473
Merged
Merged
Conversation
|
jzonthemtn
approved these changes
Nov 2, 2026
Member
|
Thanks @DG47! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #391.
The redaction policy schema's
validatorNameenum andspec/v1.0/catalog/validators.yamlname eleven validators for the custom identifier filter, butIdentifierValidatorsimplemented eight. A policy namingaba,verhoeff, ordammfailed to load withUnsupported identifier validator.Changes:
AbaValidator: the 3-7-1 weighted sum of the digits must be a multiple of 10. It requires exactly nine digits, ignoring separators, and returns false on a tenth digit rather than wrapping the weights.VerhoeffValidator: Verhoeff check digit using the D5 multiplication table and the position permutation table, with the last digit as the check digit.DammValidator: Damm check digit using the order-10 quasigroup table, with the last digit as the check digit.LuhnValidator, and follow the same singleton andisValid(String)shape. The tables match the ones in Implement the aba, verhoeff, and damm identifier validators phileas-dotnet#101.IdentifierValidatorsresolves the three names, and the message on the default case lists all eleven.identifier.mddocuments the three validators, andRELEASE_NOTES.mdhas an entry under 4.6.0.Tests:
AbaValidatorTest:021000021,011000015, and111000025are accepted. Checksum failures, separators, eight digits, and ten digits (including a valid routing number followed by a tenth digit) are covered.VerhoeffValidatorTestandDammValidatorTest: the published vectors from the issue (Verhoeff accepts2363,123451,758722and rejects12345; Damm accepts5724,112946and rejects5727,112949). There are also three property checks:To confirm the property checks catch a bad table, I swapped two entries in one row of each table. The transposition check failed for both schemes.
IdentifierValidatorsTest: the three names resolve to their validators, and the unknown-name message lists all eleven.IdentifierValidatorPolicyTest: for each validator, a JSON policy with a custom identifier and"validator": "<name>"goes throughPlainTextFilterService. A value that passes the check is redacted, and a value of the same shape that fails it stays in the text.Testing (JDK 17):
mvn --batch-mode test -Dtest='IdentifierValidatorsTest,AbaValidatorTest,VerhoeffValidatorTest,DammValidatorTest,IdentifierValidatorPolicyTest':Tests run: 67, Failures: 0, Errors: 0, Skipped: 0. With theIdentifierValidatorschange reverted, the resolution and policy tests fail withUnsupported identifier validator 'aba'(and likewise forverhoeffanddamm).mvn --batch-mode package:Tests run: 3230, Failures: 0, Errors: 0, Skipped: 0,BUILD SUCCESS