KID number (actually KID, customer identification) is a number used in bill payment in Norway to identify the payment (regardless of who pays the bill). It can be from 2 and up to 25 digits long. The last digit of the KID number is a check digit. This check digit is calculated from the MOD10 or MOD11 algorithm.
kid.Verify(code, new(Luhn10)) kid.Verify(code, new(Luhn11)) luhn10 := kid.Luhn10{}
checkDigit, err := luhn10.Generate(code)
// e.g. 7, nil luhn11 := kid.Luhn11{}
checkDigit, err := luhn11.Generate(code)
// e.g. '-', nilErrorInvalidCodeLength: KID has an invalid lengthErrorInvalidNumber: KID has an invalid character (not a digit)
Released under the MIT License.