luhn-rs
This project allows generating and verifying Luhn check digits and using arbitrary alphabets.
Example
Add this to your Cargo.toml
:
[dependencies]
luhn-rs = "0.0.1"
Then, in your crate:
extern crate luhn;
use Luhn;
Generating a check digit:
// The alphabet given dictates what input characters are allowed.
let l = new.expect;
let ch = l.generate ;
println!;
Verifying a check digit (this uses the last character in the string as the check digit):
let l = new.expect;
println!;
println!;
License
MIT