PHP salt and hash SHA256 for login password

后端 未结 6 2302
南方客
南方客 2020-12-23 17:19

I\'ve made encrypting of the password in my register script and they are stored in the database, and I have to use them to login, so I would want to use the unencrypted ones

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-23 18:06

    You can't do that because you can not know the salt at a precise time. Below, a code who works in theory (not tested for the syntaxe)

    
    

    When you insert :

    $qry="INSERT INTO member VALUES('$username', '$hashed')";
    

    And for retrieving user :

    $qry="SELECT * FROM member WHERE username='$username' AND password='$hashed'";
    

提交回复
热议问题