Skip to content

golang-infrastructure/go-Luhn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Luhn

一、这是什么?

一个银行卡校验算法,用于离线计算银行卡是否合法,关于Luhn的详情请移步https://www.cnblogs.com/cc11001100/p/9357177.html

二、安装

go get -u github.com/golang-infrastructure/go-Luhn

三、示例

package main

import (
	"fmt"
	luhn "github.com/golang-infrastructure/go-Luhn"
)

func main() {
	b := luhn.Check("8703008427912866")
	fmt.Println(b)
	// Output:
	// true

	b = luhn.Check("8703008427912861")
	fmt.Println(b)
	// Output:
	// false
}

About

Luhn algorithm(银行卡校验算法)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages