luhn

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package luhn 模 10 校验算法

1. 从右往左,偶数位数字乘以 2,如果是两位数,将其个位数和十位数相加; 2. 将以上的所有数值相加得到值 n1; 3. 从右往左,奇数位的数值加相加得到值 n2; 4. (n1+n2) % 10 如果值为 0,表示正确。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(prefix []byte) []byte

Build 为 prefix 生成最后一位校验位形成正确的字符串

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