TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Distributed ID Generation and Bit Packing

25 点作者 mr_tyzic大约 11 年前

3 条评论

lectrick大约 11 年前
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 未加载
radicalbyte大约 11 年前
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 未加载
Scaevolus大约 11 年前
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;.