Hi Jakob, I was implementing the Luhn mod N algorithm in Swift, and found a discrepancy between the Swift port and the Go original. When I calculate the first check digit for P56IOI7MZJNU2, I get an “S” instead of a “Y”.
I went through the Go code, and if I read it correctly you iterate through the string left-to-right, alternating between a factor of 1 and 2. However, in the wikipedia article about the Luhn Mode N algorithm it is specified that you should iterate right-to-left, alternating between a factor of 2 and 1.
Can you verify whether my conclusion is correct? And if it is indeed an error in the Go code, will you change it, or shall I adopt the ‘wrong’ implementation in Swift?