luhn

package module
v0.0.0-...-81a1a38 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2017 License: MIT Imports: 0 Imported by: 11

README

Luhn Algorithm

Generating check number & validating Luhn numbers in GO

Usage

import "github.com/theplant/luhn"

func main() {
	// Checking if a string is a valid luhn
	luhn.Valid(1111) //= false
	luhn.Valid(79927398713) //= true

  luhn.CalculateLuhn(7992739871) //= 3
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateLuhn

func CalculateLuhn(number int) int

CalculateLuhn return the check number

func Valid

func Valid(number int) bool

Valid check number is valid or not based on 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