luhn

package module
v0.0.0-...-8193367 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2017 License: MIT Imports: 0 Imported by: 0

README

luhn

Yet another Luhn algorithm implementation

Documentation

Overview

Package luhn implements the Luhn algorithm, which is commonly used to add checksums to credit cards and identity codes.

See https://en.wikipedia.org/wiki/Luhn_algorithm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDigit

func CheckDigit(s string) byte

CheckDigit returns the digit needed to make its input valid.

func CheckDigitInt

func CheckDigitInt(n int) int

CheckDigitInt returns the digit needed to make its input valid.

func IsValid

func IsValid(s string) bool

IsValid returns true if the input is valid according to the Luhn algorithm.

Note that IsValid assumes input characters are all digits. Output is undefined for unexpected characters.

func IsValidInt

func IsValidInt(n int) bool

IsValidInt returns true if the input is valid according to the Luhn algorithm.

Types

This section is empty.

Jump to

Keyboard shortcuts

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