What's faster/better to use: the MySQL or PHP md5 function?

后端 未结 5 1452
[愿得一人]
[愿得一人] 2021-02-19 13:44

I checked the passwords for the users against the DB.

What is faster, the MySQL MD5 function

... pwd = MD5(\'.$pwd.\')

5条回答
  •  孤城傲影
    2021-02-19 14:10

    I would say, read the column value out of mysql, then compare the result with the computed hash in your client code (e.g. php).

    The main reason for doing this is that it avoids stupid things such as the database collating the column in a non-binary fashion (e.g. case-insensitive etc), which is generally undesirable for a hash.

提交回复
热议问题