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

6 FerkiHN 3 7/20/2025, 10:55:47 AM gist.github.com ↗
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 (3)

asddfgg55 · 6h ago
The project is interesting, but in my opinion it is not very useful.
FerkiHN · 6h ago
Fair point! XID targets niche scenarios where its properties shine: 1. Resource-constrained environments (IoT/embedded) where UUIDs are too heavy 2. Offline systems needing collision resistance without coordination 3. Debuggability - timestamp extraction avoids DB lookups for audit trails 4. Zero-dependency projects (OS kernels, bootloaders, firmware)

It’s not for every use case, but fills gaps where UUIDv4/Snowflake can’t go. Curious what specific problems you’re solving where it feels less useful?

FerkiHN · 6h ago
What do you think?