#uuid #ksuid #guid


A library for efficiently generating, parsing and serializing Segment.io KSUIDs

2 unstable releases

Uses old Rust 2015

0.2.0 Jun 19, 2017
0.1.0 Jun 15, 2017

#9 in #guid

Download history 7/week @ 2021-05-25 25/week @ 2021-06-01 24/week @ 2021-06-08 4/week @ 2021-06-15 3/week @ 2021-06-22 11/week @ 2021-06-29 11/week @ 2021-07-06 4/week @ 2021-07-13 6/week @ 2021-07-20 41/week @ 2021-07-27 11/week @ 2021-08-03 36/week @ 2021-08-10 23/week @ 2021-08-17 65/week @ 2021-08-24 28/week @ 2021-08-31 41/week @ 2021-09-07

67 downloads per month
Used in 2 crates

MIT license

294 lines

Version Docs


KSUID stands for K-Sortable Unique IDentifier, a globally unique identifier used by Segment.

KSUIDs incorporate a timestamp with 1-second resolution, allowing them to be (roughly) sorted chronologically, as well as a 128-bit random payload in the style of UUIDv4. They can be serialized using a Base62 encoding for compatibility with environments which only support alphanumeric data. The lexicographic ordering of both the binary and string representations preserves the chronological ordering of the embedded timestamp.

See the canonical implementation for more information.

The author of this package is not affiliated with Segment.

This repository contains two separate crates, a library (ksuid) for generating, parsing and serializing KSUIDs and a simple CLI (ksuid-cli) which exposes a subset of this functionality for interactive use.


The library includes some benchmarks to compare its performance against the canonical implementation. However, the benchmarks use rust's unstable test crate, so they are hidden behind a feature flag. Execute cargo bench --features bench with a nightly version of the compiler to run the benchmarks.


~14K SLoC