本文介绍了文件集的哈希算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好, 我需要知道如何为一组文件而不是单个文件创建哈希码.有指针吗? 谢谢, Jib
Hi all, I need to know how I can create a hash code for a set of files, rather than individual files. Any pointers? Thanks, Jib
推荐答案首先,您必须确定必须使用哪种哈希算法.因为一旦对文件进行哈希处理,然后更改算法将很浪费. .Net框架有很多哈希算法,包括键控和非键控.每个都有不同的目的.例如,MD5擅长处理小文件.但是对于非常大的文件,您可能会发现两个唯一的文件具有相同的哈希值. 这是他们讨论哈希算法选择的链接.这可能有助于您选择算法.然后参考MSDN了解如何实现该算法 stackoverflow/questions/800685/which-hash-function-should- i-choose [ ^ ] en.wikipedia/wiki/Comparison_of_cryptographic_hash_functions [ ^ ] 哈希函数:经验比较 [ ^ ] 框架中的最大哈希密钥由MACTripleDES生成(使用24位字节的密钥长度,并生成8个字节的哈希).但是您需要确定是否需要这种长键. First you have to decide which hash algorithm has to use. Because once you hashed the files then changing the algorithm will be a waste. There are lot of hash algorithms with .Net framework, Keyed and Non-Keyed. Each has different purpose. For example MD5 is good at small files. But for very large files you may find two unique files has same hash. here is a link where they discuss about hash algorithm choices. Which may helpful for you to choose the algorithm. Then refere MSDN for how to implement that algorithm stackoverflow/questions/800685/which-hash-function-should-i-choose[^] en.wikipedia/wiki/Comparison_of_cryptographic_hash_functions[^] Hash Functions: An Empirical Comparison[^] The largest hash key is produced by the MACTripleDES (uses a key length of 24 bytes and produce a hash of 8 bytes) in framework. But you need to decide such long key is required for your case or not.
此 [^ ]可能会为您提供帮助. this[^] might help you.
更多推荐
文件集的哈希算法
发布评论