Simple crate for validating and generating Finnish Personal Identity Code (HETU).
Works with rust 1.8 stable.
Add this to your Cargo.toml
toml
[dependencies.hetu]
git = "https://github.com/jelovirt/hetu.git"
To validate:
```rust extern crate hetu; use hetu::Ssn::parse;
pub fn main() { if parse("121212-121D").is_ok() { println!("Valid HETU") } else { println!("Invalid") } } ```
To generate:
```rust extern crate hetu; use hetu::Ssn::generate;
pub fn main() { println!("{}", generate()) } ```
Command line tool hetu
can be used to either validate or randomly generate
identifiers.
To validate:
```bash $ hetu 121212-121D $ hetu 121212-121C Error: Invalid checksum
121212-121C ^ ```
To generate:
bash
$ hetu
121212-121D