cht-core
cht-core copied to clipboard
feat(#9227): add validation function for luhn algorithm
Description
#9227
The Luhn algorithm is classified as:
designed to protect against accidental errors, not malicious attacks. Most credit cards and many government identification numbers use the algorithm as a simple method of distinguishing valid numbers from mistyped or otherwise incorrect numbers.
It has several applications, as shown below. Specifically, we use it to validate South African ID numbers.
Other uses:
- Credit card numbers
- IMEI numbers
- National Provider Identifier numbers in the United States
- Canadian social insurance numbers
- Israeli ID numbers
- South African Tax reference numbers
- Swedish national identification numbers
- Swedish Corporate Identity Numbers (OrgNr)
- Greek Social Security Numbers (ΑΜΚΑ)
- ICCID of SIM cards
- European patent application numbers
- Survey codes appearing on McDonald's, Taco Bell, and Tractor Supply Co. receipts
- United States Postal Service package tracking numbers use a modified Luhn algorithm
https://en.wikipedia.org/wiki/Luhn_algorithm
Code review checklist
- [x] Tested: Unit and/or e2e where appropriate
License
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.