Packages / rupm

rs-id-nanoid 0.1.0

Compact, URL-safe unique string IDs in the NanoID style, with custom alphabets and sizes

Install

cargo add rs-id-nanoid --registry rupm

In Ruststudio: Packages, search for rs-id-nanoid, Install.

Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-23.

Versions

README

# rs-id-nanoid

Compact, URL-safe unique string IDs in the NanoID style, with custom alphabets and sizes

Add it with `rupm add rs-id-nanoid` (or `cargo add rs-id-nanoid --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 = rs_id_nanoid::nanoid();
assert_eq!(id.len(), 21);
let pin = rs_id_nanoid::custom("0123456789", 6).unwrap();
assert!(pin.chars().all(|c| c.is_ascii_digit()));
```