china_identification_card 1.1.2

A Rust library for validating Chinese identification card numbers based on official rules and checksums.
Documentation
1
2
3
4
5
6
7
8
9
10
/// Weight values used for Chinese ID card number validation.
///
/// Each digit in the ID number (except the last check digit) is multiplied by
/// the corresponding weight in this array during validation.
pub(crate) const WEIGHTS: [i32; 17] = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
/// Check code characters used for Chinese ID card validation.
///
/// The last digit of the ID number is validated against these characters
/// based on the calculated checksum.
pub(crate) const CHECK_CODES: [char; 11] = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'];