luhn_java
luhn_java copied to clipboard
Luhn.validate(String) method is incorrect
Unless I'm totally missing something in my understanding of the Luhn algorithm I believe your Luhn.validate(String)
method is incorrect and misleading for anyone who stumbles across this Git repo from the Luhn algorithm Wiki page.
The Luhn algorithm does not state that the check sum digit must be zero. The Luhn algorithm states that the sum of all the "sum digits" (including the check sum digit) modulo 10 should be 0.
Please fix or remove the link to this repo from the Wiki page. If you add some tests to your code you'll see what I mean. Thanks.
I also think it looks wrong - seems to have been broken by this commit: https://github.com/nishan/luhn_java/commit/32e724db3131f40671a651569b7a276caa099ecb#diff-f3c575fe7798240d1c8930e125ab53ec
That commit probably fixed one scenario but broke validate().