Can I md5(sha1(password))?

前端 未结 5 1284
暖寄归人
暖寄归人 2021-01-07 12:41

I\'m currently coding my own CMS and I\'m at the state of password...

I want to know if I can md5 a password then sha1 it after?

Li

5条回答
  •  死守一世寂寞
    2021-01-07 13:15

    Make sure you add a salt in there too, this makes it much harder to use rainbow tables against your customer's/user's passwords.

    Something like:

    $hashedPassword = sha1(md5($password) . $salt . sha1($salt . $password));

    Where salt can be a nice long random string itself, either constant across your application or a salt per contact which is stored with the user too.

提交回复
热议问题