uuid-by-string

Generates the RFC-4122 Name-Based UUID. Supports 3 and 5 versions of UUID with and without a namespace.
Note: generating UUID v3 and v5 without a namespace is non-standard (the RFC-4122 covers only the case when you concatenate the namespace with the name, so if you want a reproducable result in other progrmming langiages you need to generate UUID with some namespace, e.g. nil)
According to the implementation differences, it's impossible to replicate results of the no-namespace UUID generation with a standard generation, so keep that in mind.
This library is rewritten from Danakt Saushkin's JavaScript library of the same name. All features and tests are in place.
Installation
Usage
use ;
// Note: generating UUID v3 and v5 without namespace is non-standard
generate_uuid
//"2aae6c35-c94f-5fb4-95db-e95f408b9ce9";
// For namespace generation enable feature "namespaces"
use ;
generate_uuid_with_namespace.unwrap
//"1825ed38-348f-5b46-99de-fd84b83aba5e"
The string hello world
will always return 2aae6c35-c94f-5fb4-95db-e95f408b9ce9
.
You can specify the UUID version. Available versions is 3 and 5 according to RFC-4122. The version is responsible for the hashing algorithm: version 3 uses MD5, and version 5 uses SHA-1. UUIDv5 is used by default if version is not specified.
use ;
// For namespace generation enable feature "namespaces"
use ;
Replacement
You can (and should) replace this library with https://docs.rs/uuid/. The code whould look like this:
let uuid = new_v3;
let uuid = new_v5;
Since generating a UUID v3 and v5 without namespace is non-standard you either have to stick with this library or rely on your own implementation of the following methods of this library:
generate_uuid
generate_uuid_v3
generate_uuid_v5
More info about replacement: