确定散列算法 [英] Determine Hash Algorithm
问题描述
如果我有两个初始密钥和创建的哈希值,有没有办法来确定哈希算法?
If I have both the initial key and the hash that was created, is there any way to determine the hash algorithm?
例如:
重点:高
哈希:df072c8afcf2385b8d34aab3362020d0
算法=?
For example:
Key: higher
Hash: df072c8afcf2385b8d34aab3362020d0
Algorithm = ?
推荐答案
好了,因为有流行的散列算法是有限的,也许你提出什么不是太荒谬了。
Well, given that there are a finite number of popular hash algorithms, maybe what you propose is not so ridiculous.
但是假设我问你:
如果我有一个输入和输出,可 我确定函数?
If I have an input and an output, can I determine the function?
一般来说的不,你不能简单地从知道一个输入和一个输出,没有任何额外的信息来确定内部工作的任何功能。
Generally speaking, no, you cannot determine the inner-workings of any function simply from knowing one input and one output, without any additional information.
// very, very basic illustration
if (unknownFunction(2) == 4) {
// what does unknownFunction do?
// return x + 2?
// or return x * 2?
// or return Math.Pow(x, 2)?
// or return Math.Pow(x, 3) - 4?
// etc.
}
这篇关于确定散列算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!