iso7064 0.1.0

ISO 7064 MOD 97-10 check-character computation and validation (used by LEI, IBAN, ...). A faithful port of the iso-7064 npm package. Zero deps, no_std.
Documentation
  • Coverage
  • 100%
    7 out of 7 items documented3 out of 6 items with examples
  • Size
  • Source code size: 25.79 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 212.73 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • trananhtung/iso7064
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • trananhtung

iso7064

All Contributors

crates.io docs.rs CI license

ISO 7064 MOD 97-10 check characters.

Compute and validate ISO 7064 MOD 97-10 check characters — the algorithm behind LEI codes, IBAN check digits, and more. A faithful Rust port of the iso-7064 npm package, plus standard validation and check-digit-generation helpers.

  • Zero dependencies, #![no_std]
  • compute / compute_without_check (faithful to the reference)
  • is_valid and generate_check_digits
  • Differential-tested against the reference iso-7064 implementation (60k cases)

Install

[dependencies]
iso7064 = "0.1"

Usage

use iso7064::{compute, compute_without_check, is_valid, generate_check_digits};

// MOD 97 of a string:
assert_eq!(compute("969500KSV493XWY0PS").unwrap(), 54);

// Generate the two check digits and validate the full code:
assert_eq!(generate_check_digits("969500KSV493XWY0PS").unwrap(), "33");
assert!(is_valid("969500KSV493XWY0PS33"));

// `compute_without_check` skips format validation (use it on pre-validated input):
assert_eq!(compute_without_check("969500KSV493XWY0PS"), 54);

Digits 0-9 count as 0–9 and letters A-Z as 10–35. A code is valid when its MOD 97 equals 1.

Contributors ✨

This project follows the all-contributors specification. Contributions of any kind are welcome — code, docs, bug reports, ideas, reviews! See the emoji key for how each contribution is recognized, and open a PR or issue to get involved.

Thanks goes to these wonderful people:

License

Licensed under either of MIT or Apache-2.0 at your option.