There are no reviews yet. Be the first to send feedback to the community and the maintainers!
Repository Details
🍩 Sole is a lightweight C++11 library to generate universally unique identificators (UUID), both v1 and v4.
sole
Sole is a lightweight C++11 library to generate universally unique identificators (UUID).
Sole provides interface for UUID versions 0, 1 and 4.
Sole rebuilds UUIDs from hexadecimal and base62 cooked strings as well.
Sole is tiny, header-only, cross-platform.
Sole is zlib/libpng licensed.
Some theory
UUID version 1 (48-bit MAC address + 60-bit clock with a resolution of 100 ns)
UUID version 4 (122-bits of randomness)
Use v1 if you are worried about leaving it up to probabilities.
Use v4 if you are worried about security issues and determinism.
About custom version 0
UUID version 0 (16-bit PID + 48-bit MAC address + 60-bit clock with a resolution of 100ns since Unix epoch)
Format is EPOCH_LOW-EPOCH_MID-VERSION(0)|EPOCH_HI-PID-MAC
Public API
sole::uuid 128-bit UUID base type that allows comparison and sorting. std::ostream << friendly. .str() to get a cooked hex string. .base62() to get a cooked base62 string. .pretty() to get a pretty decomposed report.
sole::uuid0() creates an UUID v0.
sole::uuid1() creates an UUID v1.
sole::uuid4() creates an UUID v4.
sole::rebuild() rebuilds an UUID from given string or 64-bit tuple.