如何解密 SHA-256 加密字符串?

发布于 2025-01-05 22:28:42 字数 71 浏览 1 评论 0原文

我有一个经过加盐处理、使用 SHA-256 哈希处理、然后进行 Base64 编码的字符串。有没有办法将该字符串解码回其原始值?

I have a string that was salted, hashed with SHA-256, then base64 encoded. Is there a way to decode this string back to its original value?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

圈圈圆圆圈圈 2025-01-12 22:28:42

SHA-256 是一个 加密(单向)哈希函数,因此没有直接的方法对其进行解码。加密哈希函数的全部目的是您无法撤消它。

您可以做的一件事是暴力策略,您猜测被散列的内容,然后散列具有相同的功能,看看是否匹配。除非散列数据很容易猜测,否则可能需要很长时间。

您可能会发现问题“散列密码和加密密码之间的区别”有趣。

SHA-256 is a cryptographic (one-way) hash function, so there is no direct way to decode it. The entire purpose of a cryptographic hash function is that you can't undo it.

One thing you can do is a brute-force strategy, where you guess what was hashed, then hash it with the same function and see if it matches. Unless the hashed data is very easy to guess, it could take a long time though.

You may find the question "Difference between hashing a password and encrypting it" interesting.

埋葬我深情 2025-01-12 22:28:42

应该注意的是 - Sha256 不会加密字符串的数据/内容,而是使用您的输入字符串作为种子生成固定大小的哈希值。

情况就是这样——我可以输入百科全书的内容,文本大小很容易达到 100 mb,但生成的字符串大小仍然是 256 位。

你不可能反转哈希值,要从固定大小的哈希值中取出 100MB 的数据,你能做的最好的事情就是尝试猜测/计算种子数据、哈希值,然后查看哈希值是否与哈希值匹配你试图打破。

如果您可以反转散列,您将获得迄今为止最好的压缩形式。

It should be noted - Sha256 does not encrypt the data/content of your string, it instead generates a fixed size hash, using your input string as a seed.

This being the case - I could feed in the content of an encyclopedia, which would be easilly 100 mb in size of text, but the resulting string would still be 256 bits in size.

Its impossible for you to reverse the hash, to get that 100mb of data back out of the fixed size hash, the best you can do, is try to guess / compute the seed data, hash, and then see if the hash matches the hash your trying to break.

If you could reverse the hash, you would have the greatest form of compression to date.

带刺的爱情 2025-01-12 22:28:42

SHA* 是一种哈希函数。它创建原始数据的表示(哈希)。此哈希决不会用于重新创建原始数据。因此这不是加密。相反,可以在同一原始数据的两个不同位置使用相同的哈希函数,以查看是否生成相同的哈希值。该方法常用于密码验证。

SHA* is a hash function. It creates a representation (hash) of the original data. This hash is never intended to be used to recreate the original data. Thus it's not encryption. Rather the same hash function can be used at 2 different locations on the same original data to see if the same hash is produced. This method is commonly used for password verification.

甜`诱少女 2025-01-12 22:28:42

通过使用盐(又名 SSHA),您已经完成了正确的操作。

没有盐的 SHA 和 SHA-2(或 SHA-256)本身不再被认为是安全的!加盐 SHA 哈希称为加盐 SHA 或 SSHA。

下面是一个简单的示例,说明对 SHA-1 进行哈希处理是多么容易。对于 SHA-2,也可以毫不费力地完成同样的操作。

在此 URL 中输入密码:
http://www.xorbin.com/tools/sha1-hash-calculator
将哈希值复制粘贴到此 URL 中:
https://hashes.com/en/decrypt/hash

这是一个反哈希的页面SHA-2。此页面的工作方式是有人之前必须对您的密码进行哈希处理,否则它不会找到它:
md5hashing dot net/hashing/sha256

这是一个声称有完整的 SHA-2 表可供“捐赠”下载的页面(我还没有尝试过):
rackstation dot net/buy-crackstation-wordlist-password-cracking-dictionary.htm

这是一篇很好的文章,解释了为什么必须使用 SSHA 而不是 SHA:
破解站点网/hashing-security.htm

You've done the correct thing by using a salt aka SSHA.

SHA and SHA-2 (or SHA-256) by itself without a salt are NOT considered secure anymore! Salting a SHA hash is called Salted SHA or SSHA.

Below is a simple example on how easily it is to de-hash SHA-1. The same can be done for SHA-2 without much effort as well.

Enter a password into this URL:
http://www.xorbin.com/tools/sha1-hash-calculator
Copy paste the hash into this URL:
https://hashes.com/en/decrypt/hash

Here's a page which de-hashes SHA-2. The way this pages works is somebody must have hashed your password before, otherwise it won't find it:
md5hashing dot net/hashing/sha256

Here's a page that claims to have complete SHA-2 tables available for download for a "donation" (I haven't tried it yet):
crackstation dot net/buy-crackstation-wordlist-password-cracking-dictionary.htm

Here's a good article that explains why you have to use SSHA over SHA:
crackstation dot net/hashing-security.htm

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文