Crates.io | uuid-readable-rs |
lib.rs | uuid-readable-rs |
version | 0.1.6 |
source | src |
created_at | 2021-08-08 15:55:00.675498 |
updated_at | 2024-07-08 22:57:03.67774 |
description | Easy to remember unique sentences acting as UUID |
homepage | |
repository | https://github.com/Martichou/uuid-readable-rs |
max_upload_size | |
id | 433190 |
size | 581,420 |
Generate easy to remember sentences that acts as human readable UUIDs.
short()
or generate()
respectively)Even if this project doesn't receive a lot of update, it's not abandonned.
There's just not much to do as any changes would pretty much break the entire compatibility. But if any security issue arise, I'll take care of it asap.
This project does not mean to be crypto safe ! Don't use this as a secure random generator.
25^12
possible combinations for generate()
(uses 128-bit Token)25^5
possible combinations for short()
(uses 32-bit Token)Note that the sentence generated by generate()
and the original UUID form a bijection, hence no loss of entropy.
For the long - aka generate()
- version, a typical sentence generated by this lib looks like:
Wildon Mollie Behka the bubbler of Arecibo moaned Chavey Haney Torbart and 10 calm kingfishers
Internally this correspond to:
To ensure no loss of entropy, taking the example of the verb which represents 10 bits, this means that we used a list of verbs of at least 2^10 possibilities (1024).
For the short - aka short()
- version, a typical sentence looks like:
Zink recorded by 127 large armadillos
This correspond to:
Since the short version is 32 bits long and is derived from a 128-bit UUID, it is not considered as secure or as random as the long version may be. It also does not form any bijection with the original UUID.
use uuid::Uuid;
use uuid_readable_rs::{generate_from, short_from, generate, short, generate_inverse};
// You can define your own UUID and pass it to uuid_readable_rs like so
let uuid = Uuid::new_v4();
let sentence_128: String = generate_from(uuid);
let sentence_32: String = short_from(uuid);
// You can also get an UUID from a sentence that was previously generated
let original_uuid: Uuid = generate_inverse(sentence_128).unwrap();
assert_eq!(uuid, original_uuid);
// Or let uuid_readable_rs handle the Uuid generation
let sentence_128: String = generate();
let sentence_32: String = short();
Thanks to @Debdut for the original idea (https://github.com/Debdut/uuid-readable).
note: his version may not be suitable to use at the moment until https://github.com/Debdut/uuid-readable/issues/8 get fixed.