Skip to content

Show HN: XID – Dependency-Free Unique ID Generator in One C File

gist.github.com
7 pointsFerkiHN2 comments
On HN

XID generates 20-character globally unique IDs (48-bit timestamp + 64-bit entropy + 8-bit counter + 5-bit checksum) in a single C file with zero dependencies. Features built-in timestamp extraction, collision resistance, and portable design for any platform - ideal for databases, IoT, and distributed systems.

char id = xid_generate(); // => "01H5Z7K4W9A3B6C8D0F2G"

Gists: https://gist.github.com/Ferki-git-creator/17450d52d143f746f0...

(Feedback wanted: entropy improvements, embedded use cases, optimizations)*

Comments

What do you think?

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.