问题描述
我有一个带有两个MD5密码和一个盐的vBulletin数据库,是否可以将密码保存在vBulletin数据库中,将其转换为SHA256,然后将其存储在新数据库中?有没有真正简单的方法可以做到这一点?
I have a vBulletin Database with double MD5'd passwords and a salt, would it be possible to take the Password in the vBulletin database, convert them to SHA256, and then store them in a new database? Is there any real easy way to do this?
我的主要也是唯一的理由是,防止用户不得不创建新帐户并停止使用MD5.
My main and only reason, is to prevent users from having to create new accounts, and to stop using MD5.
推荐答案
散列算法是单向,即与加密解密算法不同,它们不能逆转.
Hashing algorithms are one-way i.e. They cannot be reversed unlike Encryption-Decryption algorithms.
MD5()
是一种哈希算法, SHA-1 / SHA-256;
MD5()
is a hashing algorithm , so is SHA-1 / SHA-256;
很高兴知道您已停止使用 MD5()
并转到了 SHA-256()
It is good to know that you have stopped using MD5()
and moving to SHA-256()
首先像这样在用户表中运行查询
First run a query in your users table like this
UPDATE users_t SET PASSWORD=SHA2(PASSWORD,256) WHERE 1=1
现在,您所有的 MD5
哈希密码都将转换为 SHA256
哈希.
Now all your MD5
Hashed passwords will be converted to SHA256
Hashes.
但是,您不能在登录/注册页面上停止使用 MD5
.您必须更改检查逻辑,例如
However, you cannot stop using MD5
on your login/register pages.. You have to change your checking logic like
$pass = $_POST['password'];
$hashedpass = hash('sha256',md5($pass)); // Now you need to insert/verify
这篇关于可以将MD5转换为SHA256吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!