Better way save password in mysql which can be decrypted also using php

前端 未结 8 1064
眼角桃花
眼角桃花 2021-01-04 08:53

I am currently using md5 function to encrypt my password and save to mysql db which can not be decrypted.

Now my user want that when they forgot password, they shou

8条回答
  •  自闭症患者
    2021-01-04 09:52

    It is not possible to store the password in such a way that it is still recoverable without either

    1) storing the decryption key in your code/data (which rather defeats the purpose of hashing/encrypting the password)

    2) encrypting the password using public/private key encryption the routing the recovery through som sort of semi-manual process where the password can be recovered.

    The simplest solution is to require your users to provide/maintain a current email address and rely on the security of that to provide a new password on request.

    C.

提交回复
热议问题