luhn

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2022 License: MIT Imports: 0 Imported by: 1

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

func GenerateWithPrefix(prefix []byte) []byte

GenerateWithPrefix 给定前缀,添加最后一位校验位

func IsValid

func IsValid(v []byte) bool

IsValid 传入 []byte 验证是否正确

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL