TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Distributed ID Generation and Bit Packing

25 pointsby mr_tyzicabout 11 years ago

3 comments

lectrickabout 11 years ago
He could have just Googled. I think Twitter&#x27;s Snowflake came to some very similar conclusions.<p><a href="https://github.com/twitter/snowflake/" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;twitter&#x2F;snowflake&#x2F;</a><p>I even wrote something in Ruby as an idea based off it (although it hasn&#x27;t been used in production yet)<p><a href="https://github.com/pmarreck/ruby-snippets/blob/master/star_id.rb" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;pmarreck&#x2F;ruby-snippets&#x2F;blob&#x2F;master&#x2F;star_i...</a>
评论 #7767114 未加载
评论 #7765240 未加载
radicalbyteabout 11 years ago
You can save a lot of time by using a UUID&#x2F;GUID and encoding in a different base for urls if you want to minimize length. They&#x27;re 32 chars in hex or 22 characters in base-64.
评论 #7764578 未加载
Scaevolusabout 11 years ago
Rather than just shuffling the bits, you could do a invertible operations, like you&#x27;d use in a block cipher. An unbalanced feistel network (24 and 23 bit halves) would be easy to implement, or even just invertible operations like &quot;x=x^rotate(x, 5)&quot;.