3 unstable releases

Uses new Rust 2024

new 0.2.0 Mar 11, 2025
0.1.1 Mar 6, 2025
0.1.0 Mar 6, 2025

#591 in Algorithms

Download history 257/week @ 2025-03-04

257 downloads per month

MIT/Apache

25KB
484 lines

Human Friendly Ids

CI Crates.io Docs.rs

This Rust library is used for generating random human-friendly ids with a base-23 character set. The ids are generated using a cryptographically secure random number generator.

The primary reason you would use this library is to generate visually unambiguous ids that are easy to read, write, and speak over the phone. The library automatically corrects for common visual confusions such as 1 vs l, 0 vs O, and 5 vs S, rn vs m, etc.

There is some excellent prior art in this space such as:

Note that this library makes no attempt to avoid creating offensive or inappropriate ids. If you need to avoid generating such ids, you should filter them out after generating them.

Getting Started

[dependencies]
human_friendly_ids = "0.2.0"

Usage

use human_friendly_ids::Id;

let id = Id::new(12);
println!("Generated ID: {}", id);

Contribution

If you would like to contribute to this project, please open an issue or a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Please observe the Unicode-3.0 license for the relevant code included in this library.

Dependencies

~1.3–1.9MB
~32K SLoC