Why is php's password_hash so slow?

后端 未结 3 625
有刺的猬
有刺的猬 2021-02-14 21:13

I am using password_hash for password encryption. However there is a strange question, password_hash cost very long time. Here is a sample code. this c

3条回答
  •  死守一世寂寞
    2021-02-14 21:26

    After running on 3v4l that seems perfectly normal.

    Password hashing is not something you want optimize. In the words of Leigh on the hash documentation:

    If you are hashing passwords etc for security, speed is not your friend. You should use the slowest method.

    Slow to hash means slow to crack and will hopefully make generating things like rainbow tables more trouble than it's worth.

提交回复
热议问题