Documentation ¶
Overview ¶
Package luhn 模 10 校验算法
https://en.wikipedia.org/wiki/Luhn_algorithm
1. 从右往左,偶数位数字乘以 2,如果是两位数,将其个数数和十位数相加; 2. 将以上的所有数值相加得到值 n1; 3. 从右往左,奇数位的数值加相加午到值 n2; 4. (n1+n2) % 10 如果值为 0,表示正确。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateWithPrefix ¶
GenerateWithPrefix 给定前缀,添加最后一位校验位
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.