Best PHP hashing method for storing user passwords in a MySQL table?

前端 未结 6 1127
半阙折子戏
半阙折子戏 2021-02-05 22:57

I\'ve been reading Stack Overflow questions for about 15 minutes now and every single one seems to contradict the previous one I read. Bcrypt, SHA1, MD5, and so on. I currently

6条回答
  •  悲&欢浪女
    2021-02-05 23:14

    You can use secret key of your website and particular salt of every user with your password. Your secret key of your website should be saved in your database and then fetch it and use.

    The combination becomes.

    $secret = "your key from database";
    $salt = "user salt";// make it randomly
    $password = $_POST['password'];
    
    $new_pass = md5($secret.$salt.$password);
    

    Now this combinations will store in database.

    At the time of login, use again this combination to match.

    I think it can help more to secure your application.

    Cheers..!!

提交回复
热议问题