7 releases
0.2.1 | Mar 15, 2020 |
---|---|
0.2.0 | Mar 6, 2020 |
0.1.4 | Mar 3, 2020 |
0.1.2 | Feb 23, 2020 |
#66 in #validate
20KB
406 lines
Kennitölur
Documentation
Documentation can be found at https://docs.rs/kennitolur
Usage
Add this to your Cargo.toml
:
[dependencies]
kennitolur = "0.1"
and this to your crate root (if you're using Rust 2015):
extern crate kennitolur;
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
lib.rs
:
Kennitölur
A kennitala (plural form: kennitölur) is a unique national identification number assigned by the Icleandic government, assigned to individuals (and organizations) in Iceland.
Number specification
Kennitalas are composed of 10 digits. The first six of these are the individual's date of birth in DDMMYY format. The seventh and eight digits are randomly chosen when the kennitala is allocated, ranging from 22 to 99. The ninth digit is the checksum digit, and the tenth indicates the century of the individual's birth.
Checksum digit
The dot product of the vector containing the first 8 digits of the kennitala
is taken with the vector [3, 2, 7, 6, 5, 4, 3, 2]
. Take the modulo 11 of
that computation. If the result r
is 0, the checksum digit is 0, otherwise it
is 11 - r
.
Dependencies
~1MB
~18K SLoC