C# Class NContrib.Luhn

Generates and validates Luhn numbers http://en.wikipedia.org/wiki/Luhn_algorithm
显示文件 Open project: veracross/ncontrib

Public Methods

Method Description
Generate ( int length ) : string

Generates a number that passes Luhn validation

Generate ( int length, string seed ) : string

Generates a number that passes Luhn validation. Number starts with the specified seed value

IsValid ( string number ) : bool

Checks to see if this number as a string passes a Luhn check

Method Details

Generate() public static method

Generates a number that passes Luhn validation
public static Generate ( int length ) : string
length int
return string

Generate() public static method

Generates a number that passes Luhn validation. Number starts with the specified seed value
public static Generate ( int length, string seed ) : string
length int Total length of the number to generate
seed string Optional numbers with which to seed the sequence
return string

IsValid() public static method

Checks to see if this number as a string passes a Luhn check
public static IsValid ( string number ) : bool
number string Number as a string to check
return bool