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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Ask HN: Merkle Trees / Rolling Hashes for XML or JSON

2 点作者 lichtenberger将近 6 年前
Hi,<p>I want to build a merkle-tree for a binary JSON document store. A merkle-tree however is built bottom up, such that a hash of inner nodes is always built concatenating all children hashes.<p>However, this is costly as always all children of the ancestor nodes have to be read when we do simple update operations. That is deleting, updating or inserting a node, potentially involving a lot of I&#x2F;O to read the children for each ancestor node.<p>As I want to use the hashes for speeding up comparisons of revisions of the binary XML or JSON tree structures, I instead could also use random UUIDs, which are assigned. However, with the merkle-tree we can also check integerity, which is nice.<p>When the hashes don&#x27;t have to be secure, we can also use a rolling hash using a 64Bit integer (long in Java), but I guess in a 64Bit storage system there are a lot of collisions and I couldn&#x27;t rely on them when doing hash comparisons for skipping whole subtrees from the traversal. Maybe it would be better with a BigInteger using 128 Bits.<p>Would you instead store UUIDs for each node? Or can I apply a secure rolling hash somehow (at most I want to store 16 bytes &#x2F; 128 bits on disk I guess)?<p>kind regards Johannes

暂无评论

暂无评论