nanoid-tools 0.1.0
Compact, URL-safe unique string IDs in the NanoID style, with custom alphabets and sizes
Install
cargo add nanoid-tools --registry rupm
In Ruststudio: Packages, search for nanoid-tools, Install.
Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-22.
Versions
- 0.1.0 2026-11-22
README
# nanoid-tools
Compact, URL-safe unique string IDs in the NanoID style, with custom alphabets and sizes
Add it with `rupm add nanoid-tools` (or `cargo add nanoid-tools --registry rupm`).
Randomness comes from /dev/urandom where it exists, otherwise from the standard library's randomly keyed hasher mixed with the clock. That is fine for unique IDs but is not a vetted cryptographic generator, so do not rely on these IDs as secrets or tokens in security-critical use.
```rust
let id = nanoid_tools::nanoid();
assert_eq!(id.len(), 21);
let pin = nanoid_tools::custom("0123456789", 6).unwrap();
assert!(pin.chars().all(|c| c.is_ascii_digit()));
```