Expand description
Provides tools for building different check-digit algorithms.
This package contains implementations of various check digit specifications, including ISO/IEC 7064:2003 Information technology — Security techniques — Check character systems.
§Example
ⓘ
use codes_check_digits::{luhn, Calculator};
let calculator = luhn::get_algorithm_instance();
assert!(calculator.is_valid("US0378331005"));
assert!(calculator.validate("US0378331005").is_ok());
assert_eq!(calculator.calculate("US037833100"), Ok(5));§Features
gs1- Adds thegs1module containing algorithms for various codes such as EAN, GTIN, GLN, and UPC.iso_7064- Adds theiso_7064module containing implementations of the variants defined in ISO/IEC 7064:2003.luhn- Adds theluhnmodule containing an implementation of the Luhn Algorithm.sedol- Adds thesedolmodule containing an implementation of the algorithm used in SEDOL numbers.
Modules§
- error
- Provides the crate’s Error and Result types as well as helper functions.
- gs1
- The type CheckDigitAlgorithm provides an implementation of the check digits specified for GS1 data types.
- iso_
7064 - Provides an implementation of the ISO/IEC 7064:2003 Information technology — Security techniques — Check character systems standard.
- luhn
- The type CheckDigitAlgorithm provides an implementation of the Luhn Algorithm.
- sedol
- The type CheckDigitAlgorithm provides an implementation of the check digit calculation as part of the SEDOL specification.
Macros§
Traits§
- Calculator
- Trait for types that implement check digit algorithms.
- Code
With Check Digits