密码加密后解密密码 [英] Decrypting password after a password hash encrypt

查看:718
本文介绍了密码加密后解密密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的密码加密代码:

This is my password encrypting code :

// Create a 256 bit (64 characters) long random salt
// Let's add 'something random' and the username
// to the salt as well for added security
$salt = hash('sha256', uniqid(mt_rand(), true) . 'something random' . strtolower($username));

// Prefix the password with the salt
$hash = $salt . $password;

// Hash the salted password a bunch of times
for ( $i = 0; $i < 100000; $i ++ )
{
    $hash = hash('sha256', $hash);
}

// Prefix the hash with the salt so we can find it back later
$hash = $salt . $hash;

我失去了教程网站。有人知道如何解密这个加密。非常感谢你。欣赏你的帮助

I lost the tutorial site. Do anyone know how to decrypt this encryption. Thank you very much. Appreciate your help

推荐答案

没有* de * cryption算法,因为没有* en * cryption算法。你正在做的是一个哈希,这是一个不可逆的操作。这就是要点,你不想存储任何甚至可以让你知道实际的密码是什么的东西。

There is no *de*cryption algorithm because there's no *en*cryption algorithm. What you're doing is a hash, which is a non-reversible operation. And that's exactly the point, you do not want to store anything that would even allow you the chance of knowing what the actual secret password is.

这篇关于密码加密后解密密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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