cn-id-card

Crates.iocn-id-card
lib.rscn-id-card
version0.1.8
sourcesrc
created_at2022-03-06 05:19:48.59561
updated_at2023-05-23 01:58:48.366428
descriptionChinese identification card number verification, including region code, birthday, and check code.
homepage
repositoryhttps://github.com/cstkingkey/id-card-rust.git
max_upload_size
id544376
size335,685
(cstkingkey)

documentation

README

Fork of https://github.com/Ethan1225/id-card-rust

cn-id-card

Chinese person identification card number verification, including region code, birthday, and check code. Chinese unified social credit code verification, including check code only.

License

APL 2.0, see LICENSE file.

Installation

In Cargo.toml add

[dependencies]
cn-id-card="0.1"

Then re-run cargo build. That fetches the dependencies and builds the code.

Usage

extern crate cn_id_card;

fn main() {
    println!("{}", cn_id_card::validate("440524188001010014", true));//outputs: true
    println!("{}", cn_id_card::validate_code("12100000400009880K", true));//outputs: true
}

Development

Test changes before commitment.(Install nightly if it haven't been installed: rustup install nightly)

cargo clean
cargo fmt --all -- --check
cargo build
cargo +nightly bench
cargo test

Commit count: 29

cargo fmt