tckimlik
Validate Turkish national identification numbers (T.C. Kimlik No.).
The Turkish Identification Number (Türkiye Cumhuriyeti Kimlik Numarası) is an 11-digit
number assigned to every citizen of Turkey, whose last two digits are check digits. A
faithful Rust port of the algorithm used by
python-stdnum.
- Zero dependencies,
#![no_std] is_valid,validate,calc_check_digits,compact- Differential-tested against
python-stdnum(60k cases)
Install
[]
= "0.1"
Usage
use ;
assert!;
assert!; // wrong check digit
assert!; // must not start with 0
assert_eq!; // trims whitespace
assert_eq!; // the two check digits
The number is valid when it has 11 digits, does not start with 0, and its last two digits
equal check1 = (10 - Σ wᵢ·dᵢ) mod 10 and check2 = (check1 + Σ dᵢ) mod 10 computed over the
first nine digits (weights 3,1,3,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.