#uuid #random #id #url

nano-id

A tiny, secure, URL-friendly, unique string ID generator for Rust

4 releases (2 breaking)

0.2.0 Oct 1, 2021
0.1.1 Jun 17, 2021
0.1.0 Apr 7, 2021
0.0.1 Apr 6, 2021

#13 in #id

Download history 7/week @ 2021-08-11 4/week @ 2021-08-18 15/week @ 2021-08-25 53/week @ 2021-09-01 252/week @ 2021-09-08 195/week @ 2021-09-15 3/week @ 2021-09-22 31/week @ 2021-09-29 344/week @ 2021-10-06 21/week @ 2021-10-13 56/week @ 2021-10-20 2/week @ 2021-10-27 107/week @ 2021-11-03 22/week @ 2021-11-10 6/week @ 2021-11-17 37/week @ 2021-11-24

172 downloads per month
Used in 3 crates (2 directly)

MIT/Apache

7KB
72 lines

nano-id

A tiny, secure, URL-friendly, unique string ID generator for Rust

Inspired by nanoid

Features

  • Base58: ModueSymbhaswnPr123456789ABCDEFGHNRVfgctiUvzKqYTJkLxpZXjQW, (123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz)
  • Base62: ModuleSymbhasOwnPr0123456789ABCDEFGHNRVfgctiUvzKqYTJkLxpZXIjQW, (A-Za-z0-9)
  • Base64: ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW, (A-Za-z0-9_-)
  • Random: data by getrandom
  • Alphabet: custom with gen!(uid, 64, b"_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")

Installation

cargo add nano-id

Usage

nano_id::base64::<21>();

// Custom ALPHABET
nano_id::gen!(
    uid,
    64,
    b"_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
);

uid::<21>();

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~72KB