我正在寻找the wikipedia article for hash trees ,我对他们的图表有点困惑。
叶节点显然包含底层数据的散列。
哈希树中的叶节点是否不同于任何非叶节点?非叶节点包含数据的哈希值,还是哈希值的哈希值?
给定这张图:
以下哪个是 Hash 1
的哈希值?
哈希 1-0
+哈希 1-1
数据 block 002
+数据 block 003
或者哈希树是否根据应用程序(rsync、P2P 网络、Git 等)而根本不同?
最佳答案
这是 wiki 文章所说的:
Nodes further up in the tree are the hashes of their respective children. For example, in the picture hash 0 is the result of hashing hash 0-0 and then hash 0-1. That is,
hash 0 = hash( hash 0-0 || hash 0-1 )
where || denotes concatenation.
但我真的相信开发人员可以自定义树和算法,使用不同的哈希函数等,针对不同的数据、速度或内存等对其进行优化。
关于algorithm - 在哈希树中,非叶子节点是直接数据的哈希,还是子哈希的哈希?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8411144/