#id #algorithm #digits #numbers

damm

Implementation of the Damm algorithm in Rust

1 unstable release

Uses old Rust 2015

0.1.0 Oct 13, 2018

#38 in #digits

Download history 151/week @ 2023-12-06 105/week @ 2023-12-13 107/week @ 2023-12-20 62/week @ 2023-12-27 115/week @ 2024-01-03 129/week @ 2024-01-10 161/week @ 2024-01-17 197/week @ 2024-01-24 134/week @ 2024-01-31 131/week @ 2024-02-07 104/week @ 2024-02-14 184/week @ 2024-02-21 311/week @ 2024-02-28 295/week @ 2024-03-06 277/week @ 2024-03-13 154/week @ 2024-03-20

1,074 downloads per month

Unlicense

5KB
50 lines

damm

Implements the Damm algorithm. See the docs for more info.


lib.rs:

This is a Rust implementation of the Damm algorithm. The algorithm is used for ID validation to catch common transposition errors.

This crate provides a simple and fast implementation of the Damm algorithm using u128 as the type of the id. The only downside to this approach is that the largest ID that one can use is 340282366920938463463374607431768211455, which means that the largest number of digits that one can use reliably is 38.

If for some reason this is a major issue for someone needing any more digits than that, open an issue at gitlab and I'll extend this library to provide a string representation for Really Long ID's™.

Dependencies

~11KB