如何在C#中生成Merkle哈希树 [英] how to generate merkle hash tree in c#

查看:116
本文介绍了如何在C#中生成Merkle哈希树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友我想在c#中生成字符串数据的Merkle哈希树,以便我可以通过nfs或bfs的任何方式遍历该树.我想创建一个自下而上的方法,意味着如果有10个字符串,则首先计算每个字符串的哈希字符串,然后合并两个哈希值并以这种方式重新计算哈希键,直到树的根.我该如何在c#中做到这一点,这是关于MHT而不是B树的问题,请帮帮我.谢谢.

Hello friends I want to generate Merkle hash tree of string data in c#.so that I can traverse the tree in any way nfs or bfs.I want to create bottom up approach means if there are 10 strings first calculate hash of each string then combine two hash values & recompute there hash key in this way go up to root of tree.how can I do this in c# It is about MHT not B tree please help me.thanks.

推荐答案

如果从头开始,我建议您阅读一下有关此树的工作原理和实现方法.它看起来并不难.我也看不到任何可以帮助您的特殊秘密".您可以实施它,询问是否有特殊问题.我已经回答了您过去有关如何创建哈希函数的问题.

或者:您是否看到此CodeProject文章具有完整的C#实现, ThexCS-C#中的TTH(老虎树哈希)制造商 [ ^ ]?

顺便说一下,本文是从Wikipedia引用的,您可以在其中了解这棵树的工作原理并找到其他参考.请参见 http://en.wikipedia.org/wiki/Merkle_Hash_Tree [
I would advice you to read about how this tree work and implement if from scratch. It does not look hard. I also don''t see any special "secrets" that could help you. You can just implement it, ask if you have particular problems. I already answered to you past question on how to create a hash function.

Alternatively: did you see this CodeProject article with complete C# implementation, ThexCS - TTH (tiger tree hash) maker in C#[^]?

By the way, this article is referenced from Wikipedia where you can learn how this tree works and find other references. See http://en.wikipedia.org/wiki/Merkle_Hash_Tree[^].

This information should be enough.

—SA


这篇关于如何在C#中生成Merkle哈希树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆