dsj60862
2013-10-21 05:37
浏览 1.0k
已采纳

可以将MD5转换为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?

My main and only reason, is to prevent users from having to create new accounts, and to stop using MD5.

图片转代码服务由CSDN问答提供 功能建议

我有一个带有双MD5密码和盐的vBulletin数据库,是否可以输入密码 vBulletin数据库,将它们转换为SHA256,然后将它们存储在新的数据库中? 有没有真正简单的方法呢?

我唯一的理由是阻止用户创建新帐户,并停止使用MD5。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douchun6108 2013-10-21 06:16
    已采纳

    Hashing algorithms are one-way i.e. They cannot be reversed unlike Encryption-Decryption algorithms.

    MD5() is a hashing algorithm , so is SHA-1 / SHA-256;

    It is good to know that you have stopped using MD5() and moving to SHA-256()

    Solution to your problem.

    First run a query in your users table like this

    UPDATE users_t SET PASSWORD=SHA2(PASSWORD,256) WHERE 1=1
    

    Now all your MD5 Hashed passwords will be converted to SHA256 Hashes.

    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
    
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题