Repository navigation
fix(kr/rrn): skip the check digit for alien registration numbers - #256
Merged
Merged
Conversation
Numbers with century/gender digit 5-8 are alien registration numbers (외국인등록번호). Their check digit formula isn't published: the Enforcement Decree of the Immigration Act (Article 40-3) leaves the scheme to the Minister of Justice. python-stdnum applies the RRN formula, other validators add 2 to it, and neither cites a source, so valid numbers could be rejected. Check only the length, digits and birth date, as for numbers issued since 2020.
2 of 32 tasks
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.
kr/rrnaccepts alien registration numbers (외국인등록번호, 7th digit 5–8) but checked them with the RRN check digit formula. That formula has no source for ARNs, so valid numbers could be rejected. This change checks only the length, digits and birth date for them, the same as for numbers issued since October 2020.Refs #3
Evidence
(13 - sum % 11) % 10, which is always the RRN value + 2. The two can't both be right, and neither cites a source.Comparison with python-stdnum 2.2
Mutation diff over 20,500 inputs (the spec's valid numbers with every 7th and last digit, plus 20,000 random dated numbers), comparing this branch with
main: the only change is 4,398 numbers now accepted thatmainand python-stdnum reject. All of them have a 7th digit of 5–8 and a birth year before 2020. Nothing else changed. This is a deliberate difference from python-stdnum, to be noted on #91.Not verified