5 ms·
Show HN: XID – Dependency-Free Unique ID Generator in One C File
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/17450d52d143f746f00fb1c903c06bb2 https://gist.github.com/Ferki-git-creator/17450d52d143f746f0...
(Feedback wanted: entropy improvements, embedded use cases, optimizations)*
- asddfgg55 1y ago[dead]
- FerkiHN 1y agoFair 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 1y agoWhat do you think?