luhn

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2014 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package luhn generates and validates Luhn mod N check digits.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alphabet

type Alphabet string

An alphabet is a string of N characters, representing the digits of a given base N.

var (
	Base32 Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"
)

func (Alphabet) Generate

func (a Alphabet) Generate(s string) (rune, error)

Generate returns a check digit for the string s, which should be composed of characters from the Alphabet a.

func (Alphabet) Validate

func (a Alphabet) Validate(s string) bool

Validate returns true if the last character of the string s is correct, for a string s composed of characters in the alphabet a.

Jump to

Keyboard shortcuts

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