问题描述
我阅读了有关 md5 哈希的 Wikipedia 文章,但我仍然无法理解如何无法将哈希重构"回原始文本.
I read the Wikipedia article about md5 hashes but I still can't understand how a hash can't be "reconstituted" back to the original text.
有人可以向对密码学知之甚少的人解释这是如何工作的吗?函数的哪一部分使它成为单向的?
Could someone explain to someone who knows very little about cryptography how this works? What part of the function makes it one-way?
推荐答案
既然到现在大家都简单的定义了hash函数是什么,那我就咬咬牙.
Since everyone until now has simply defined what a hash function was, I will bite.
单向函数不仅仅是一个散列函数——一个丢失信息的函数——而是一个函数f
,给定一个图像y
("SE"或现有答案中的 294),很难找到原图像 x 使得 f(x)=y
.
A one-way function is not just a hash function -- a function that loses information -- but a function f
for which, given an image y
("SE" or 294 in existing answers), it is difficult to find a pre-image x such that f(x)=y
.
这就是为什么它们被称为单向:您可以计算图像,但找不到给定图像的原图像.
This is why they are called one-way: you can compute an image but you can't find a pre-image for a given image.
到目前为止,在现有答案中提出的普通哈希函数都没有这个属性.它们都不是单向加密哈希函数.例如,给定SE",您可以轻松获取输入SXXXE",即具有 X-encode("SXXXE")=SE 属性的输入.
None of the ordinary hash function proposed until now in existing answers have this property. None of them are one-way cryptographic hash functions. For instance, given "SE", you can easily pick up the input "SXXXE", an input with the property that X-encode("SXXXE")=SE.
没有简单"的单向函数.他们必须将输入混合得非常好,以至于您不仅无法识别输出中的输入,而且您也无法识别另一个输入.
There are no "simple" one-way functions. They have to mix their inputs so well that not only you don't recognize the input at all in the output, but you don't recognize another input either.
SHA-1 和 MD5 曾经是流行的单向函数,但它们都几乎被破坏(专家知道如何为给定图像创建预映像,或者几乎能够这样做).正在进行一场选择新标准的竞赛,该标准将被命名为 SHA-3.
SHA-1 and MD5 used to be popular one-way functions but they are both nearly broken (specialist know how to create pre-images for given images, or are nearly able to do so). There is a contest underway to choose a new standard one, which will be named SHA-3.
一种明显的反转单向函数的方法是计算许多图像并将它们保存在一个表中,将每个图像与生成它的原图像相关联.为了使这在实践中成为不可能,所有单向函数都具有较大的输出,至少 64 位,但可能更大(例如,512 位).
An obvious approach to invert a one-way function would be to compute many images and keep them in a table associating to each image the pre-image that produced it. To make this impossible in practice, all one-way function have a large output, at least 64 bits but possibly much larger (up to, say, 512 bits).
大多数加密哈希函数是如何工作的?
How do most cryptographic hash functions work?
通常,它们的核心只有一个函数,可以对比特块进行复杂的转换(块密码).该函数应该几乎是双射的(它不应该将太多的序列映射到同一张图像,因为这会在以后导致弱点),但它不必是完全双射的.并且这个函数被迭代了固定的次数,足以使输入(或任何可能的输入)无法识别.
Usually they have at their core a single function that does complicated transformations on a block of bits (a block cipher). The function should be nearly bijective (it shouldn't map too many sequences to the same image, because that would cause weaknesses later) but it doesn't have to be exactly bijective. And this function is iterated a fixed number of times, enough to make the input (or any possible input) impossible to recognize.
以 Skein 为例,它是 SHA-3 上下文的有力候选者之一.它的核心功能被迭代了72次.函数的创建者知道如何有时将输出与某些输入相关联的唯一迭代次数是 25.他们说它的安全系数"为 2.9.
Take the example of Skein, one of the strong candidates for the SHA-3 context. Its core function is iterated 72 times. The only number of iterations for which the creators of the function know how to sometimes relate the outputs to some inputs is 25. They say it has a "safety factor" of 2.9.
这篇关于单向哈希函数如何工作?(已编辑)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!