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 the gs1 module containing algorithms for various codes such as EAN, GTIN, GLN, and UPC.
  • iso_7064 - Adds the iso_7064 module containing implementations of the variants defined in ISO/IEC 7064:2003.
  • luhn - Adds the luhn module containing an implementation of the Luhn Algorithm.
  • sedol - Adds the sedol module containing an implementation of the algorithm used in SEDOL numbers.

Modules

Provides the crate’s Error and Result types as well as helper functions.
The type CheckDigitAlgorithm provides an implementation of the check digits specified for GS1 data types.
Provides an implementation of the ISO/IEC 7064:2003 Information technology — Security techniques — Check character systems standard.
The type CheckDigitAlgorithm provides an implementation of the Luhn Algorithm.
The type CheckDigitAlgorithm provides an implementation of the check digit calculation as part of the SEDOL specification.

Traits

ait for types that implement check digit algorithms.