计算该字符串将具有相同的哈希字符串

2023-09-11 05:09:50 作者:斯文

与SHA-1是有可能找出哪些有限字符串将呈现相同的哈希?

with SHA-1 is it possible to figure out which finite strings will render equal hashes?

推荐答案

您正在寻找的是解决了的 冲突问题 (参见碰撞攻击)。一个精心设计和强大的加密散列函数的设计的与尽可能多的混淆数学尽可能地使这个问题尽可能的努力的意图。

What you are looking for is the solution to the Collision Problem (See also collision attack). A well-designed and powerful cryptographic hash function is designed with the intent of as much obfuscating mathematics as possible to make this problem as hard as possible.

事实上,一个好的哈希函数的的措施之一是寻找冲突的难度。 (在其他措施,反转散列函数的难度)

In fact, one of the measures of a good hash function is the difficulty of finding collisions. (Among the other measures, the difficulty of reversing the hash function)

应当指出的是,在散列其中输入是字符串的任何长度和输出是一个固定长度的字符串,所述的 鸽巢原理 确保了为任何给定的字符串至少一次碰撞。然而,找到这个字符串是不容易的,因为它需要基本上盲目猜测和检查过的字符串基本上无限集合。

It should be noted that, in hashes where the input is any length of string and the output is a fixed-length string, the Pigeonhole Principle ensures that there is at least one collision for any given string. However, finding this string is not as easy, as it would require basically blind guess-and-check over a basically infinite collection of strings.

这可能是有用的读入理想的散列函数。 Hash函数的设计是功能,其中

It might be useful to read into the the ideal hash functions. Hash functions are designed to be functions where

小改变输入导致输出激进的,混乱的修改 碰撞被减少到最低限度 这是困难的,或者理想情况下,不可能扭转 有没有哈希值是不可能获得任何投入(这一个重要显著少加密的目的)

理论完美的哈希算法将是一个随机预言 - 也就是说,对于每一个输入,输出一个完全随机输出,但条件是对于相同的输入时,输出将是相同的(这个条件满足附魔,由宙斯和精灵仙子的手,或者在某种程度上,任何人都不能可能理解或找出)

The theoretical "perfect" hash algorithm would be a "random oracle" -- that is, for every input, it outputs a perfectly random output, on the condition that for the same input, the output will be identical (this condition is fulfilled with magic, by the hand of Zeus and pixie fairies, or in a way that no human could ever possibly understand or figure out)

不幸的是,这是pretty的多是不可能的,最终的基础上,所有的哈希值判断为强多少这些特质,他们所拥有的,以及在何种程度。

Unfortunately, this is pretty much impossible, and ultimately, all hashes are judged as "strong" based on how much of these qualities they possess, and to what degree.

像SHA1和MD5散列将是pretty的强,并且或多或少的计算不可能找到碰撞的(一个合理的时间框架内)。最终,你不需要找一个哈希是不可能找到冲突的。你只需要实践之一,它的难度足够大,它会是太昂贵的计算(即一十亿或兆年才能找到一个碰撞上)

A hash like SHA1 or MD5 is going to be pretty strong, and more or less computationally impossible to find collisions for (within a reasonable time frame). Ultimately, you don't need to find a hash that is impossible to find collisions for. You only practically need one where the difficulty of it is large enough that it'd be too expensive to compute (ie, on the order of a billion or a trillion years to find a collision)

由于所有的哈希值是不完美的,我们可以分析它的内部工作,看到数学模式和启发,并试图找到沿着这一模式的碰撞。这类似于散列函数为7%...哈希的13号是13%7 = 6,89%7 = 5,如果你看到的3哈希,您可以使用模数函数的数学理解不难发现碰撞(即10) 1 。幸运的是,强大的散列函数有很多,很多,更难理解的数学基础。 (理想情况下,这么辛苦,没有人会永远理解!)

Due to all hashes being imperfect, one could analyze the internal workings of it and see mathematical patterns and heuristics and try to find collisions along that pattern. This is similar to a hash function being %7...Hashing the number 13 would be 13%7 = 6, 89%7 = 5. If you saw a hash of 3, you could use your mathematical understanding of the modulus function to easily find a collision (ie, 10)1. Fortunately for us, stronger hash functions have much, much, much harder to understand mathematical basis. (Ideally, so hard that no human would ever understand it!)

一些数字:

查找为单个给定SHA-0哈希碰撞发生在顶部的超级计算机在世界上运行的计算,用固有的数学模式的约13整天。 据一个有用的评论者,MD5碰撞可以被迅速产生足够小于理想敏感用途。 在没有可行的或实际的/可用碰撞的发现方法SHA-1已经发现或者到目前为止被证明,但正如在评论中指出,有一些已经发现了一些薄弱环节。

下面是一个相似,所以怀疑,其中有答案比我更聪明。

Here is a similar SO question, which has answers much wiser than mine.

1 注意的是,虽然该散列功能较弱的碰撞,它是强大的它,这是完全不可能往回走,找到一个给定的关键,如果你的散列是,说4.有一个无限量(即,4,11,18,25 ...)