哈希字符串的强大功能并将其还原 [英] a strong function for hash strings and restore it

查看:308
本文介绍了哈希字符串的强大功能并将其还原的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个强大的哈希函数(算法)来哈希我的代码。 我想将哈希字符串恢复为原始字符串
(我可以将 sha 恢复到原始状态吗?)

I'm looking for a strong hash function (algorithm) to hash my codes. i want to restore hashed string to original string. (can i restore sha to original?)

您能帮我吗?

推荐答案

您无法从哈希还原原始数据,因为哈希在设计上是不可逆的。通常的解释是 Pigeonhole原理-大多数哈希值约为128-256位,因此16-32字节大小。只要您的字符串长于(甚至早于)此字符串,就会有两个具有相同哈希值的字符串。这称为碰撞

You can't restore the original data from a hash as it is not reversible by design. An usual explanation is the Pigeonhole Principle - most hashes are about 128-256 bits, so 16-32 bytes in size. As soon as your string is longer (and even before this) than this, there will be two strings that have the same hash. This is called a collision.

还要注意,短于16-32字节的字符串通常可以颠倒,尽管您也不应该依赖于此,因为它也可能会发生冲突。例如,对诸如 test 之类的字符串进行哈希处理,然后在Google上搜索哈希。

Also note that strings shorter than 16-32 bytes can often be reversed, although you shouldn't rely on this as there can be collisions, too. For example, hash some string like test and search for the hash on Google.

尽管如此,甚至 test 和其他一些短词可以具有相同的哈希值,因此您永远不会100%确定自己拥有正确的字符串。

Nevertheless, even test and some other short word could have the same hash, so you'll never be 100% sure you've got the right string.

这篇关于哈希字符串的强大功能并将其还原的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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