password security in PHP

后端 未结 5 1748
难免孤独
难免孤独 2021-01-02 17:02

What method would you call safest and most secure? I took these snippets off php.net. I\'m just wondering because people posted their own and I just couldn\'t catch on to u

5条回答
  •  孤城傲影
    2021-01-02 17:39

    
    

    This one I think suits most of the purpose so I will explain it . Reason there are two salt are because lets say $salt1 is unique to every username hence its an column in the user table (a random string generated when user registers), $salt2 is stored on filesystem somewhere in config.ini file which was created when the application was installed and its same for all users . Now to guess the password hacker will need $salt1 and $salt1 , he can have access to salt1 through sql injection , but not have access to filesystem where salt2 is sotred inside config.ini hence double protection .

提交回复
热议问题