散列的一种方式怎么可能? [英] How is one way hashing possible?

查看:55
本文介绍了散列的一种方式怎么可能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道,散列的一种方式怎么可能?如何仅在一个方向而不是另一个方向上编码字符串?如果您逆转算法,就无法解码md5之类的东西吗?在我之前,唯一可行的方法是让它生成随机答案,而不是使用算法.但这每次都以相同的方式散列.请给我解释一下.

I was wondering, how is one way hashing possible? how can you encode a string in only one direction and not the other? If you reverse the algorithm, can't you decode something like md5? Before, to me, the only way that is possible is to have it generate a random answer instead of using an algorithm. But it hashes the same way every time. Please explain this to me.

推荐答案

如果逆向"算法,则无法找回原始字符串,因为可能的字符串多于可能的哈希码.

If you "reverse" the algorithm, you cannot get the original string back, because there are more possible strings than possible hash codes.

考虑一个具有64位整数结果的算法.可能有2 ^ 64 =(2 ^ 8)^ 8 = 256 ^ 8这样的数字.

Think of an algorithm that has a result 64-bit integers. There are 2^64 = (2^8)^8 = 256^8 possible such numbers.

但是,这意味着,如果有超过256 ^ 8个可能的字符串,则必须有两个字符串散列为相同的值(这称为

But that means, that if there are more then 256^8 possible strings, then there must be two strings that hash to the same value (this is called the pigeonhole principle). Since there are more strings at length 9 (256^9 such strings), the fact that you can get a hash value, does not guarantee you can "go back".

这篇关于散列的一种方式怎么可能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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