From a865f32d12d38d169347cbca4aa63e094cd5c303 Mon Sep 17 00:00:00 2001 From: Taylor Fausak Date: Sun, 18 Aug 2024 10:18:34 -0500 Subject: [PATCH] Announce Heptapod (#175) --- _posts/2024-08-18-heptapod.md | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 _posts/2024-08-18-heptapod.md diff --git a/_posts/2024-08-18-heptapod.md b/_posts/2024-08-18-heptapod.md new file mode 100644 index 0000000..ac40c64 --- /dev/null +++ b/_posts/2024-08-18-heptapod.md @@ -0,0 +1,39 @@ +--- +title: 'Announcing Heptapod: Generate UUIDv7 in Haskell' +--- + +I'm happy to announce [Heptapod][1], a tiny Haskell library for generating version 7 UUIDs. +If you're not familiar with UUIDv7s, they are defined by [RFC 9562][2]. +As a brief summary, they are sort of like a mix of UUIDv1s and UUIDv4s. +They start with a timestamp and end with some randomness. +Here's a diagram of their layout: + +``` + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| unix_ts_ms | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| unix_ts_ms | ver | rand_a | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +|var| rand_b | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| rand_b | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +``` + +Heptapod allows you to generate UUIDv7s. +`unix_ts_ms` comes from [`getSystemTime`][3]. +Both `rand_a` and `rand_b` both come from [`getEntropy`][4], which is cryptographically secure. + +The `rand_a` field can be a few different things: additional clock precision, a monotonic counter, or simply more randomness. +Heptapod chooses the latter. +If you'd like it to be something else, Heptapod also allows you to build your own UUIDv7 using provided values for `unix_ts_ms`, `rand_a`, and `rand_b`. + +That's it! +Please check out [Heptapod][1] and consider using version 7 UUIDs! + +[1]: https://hackage.haskell.org/package/heptapod-1.0.0.0 +[2]: https://datatracker.ietf.org/doc/html/rfc9562 +[3]: https://hackage.haskell.org/package/time-1.14/docs/Data-Time-Clock-System.html#v:getSystemTime +[4]: https://hackage.haskell.org/package/entropy-0.4.1.10/docs/System-Entropy.html#v:getEntropy