#uuid #random #id #url

nano-id

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

7 unstable releases

0.3.1 Mar 28, 2023
0.3.0 Jul 11, 2022
0.2.1 Apr 30, 2022
0.2.0 Oct 1, 2021
0.0.1 Apr 6, 2021

#352 in Web programming

Download history 181/week @ 2023-02-14 248/week @ 2023-02-21 1009/week @ 2023-02-28 383/week @ 2023-03-07 92/week @ 2023-03-14 1140/week @ 2023-03-21 950/week @ 2023-03-28 588/week @ 2023-04-04 508/week @ 2023-04-11 450/week @ 2023-04-18 335/week @ 2023-04-25 202/week @ 2023-05-02 364/week @ 2023-05-09 177/week @ 2023-05-16 43/week @ 2023-05-23 156/week @ 2023-05-30

884 downloads per month
Used in 2 crates

MIT/Apache

8KB
75 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

~57–355KB