luhncalc
luhncalc is a small crate that works both as a command-line utility and as a Rust library for validating digit sequences with the Luhn algorithm and calculating the next check digit.
Command line usage
Validate the following invalid digit sequence 1234567890:
> luhncalc
Validate the following valid digit sequence 12345678903:
> luhncalc
Library usage
Add the crate to your project:
[]
= "1"
Use one of the public functions from Rust code:
use ;
The library returns an error when the digit sequence is empty or contains anything other than ASCII digits 0-9.
License
This project is licensed under either of
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-20 license, shall be dual licensed as above, without any additional terms or conditions.