Static Salt vs Random Salt - Security PHP

后端 未结 5 1177
南方客
南方客 2020-12-30 10:08

Is there any working difference between

$hash=sha1($key.$staticSalt);  

and

$hash=sha1($key.$randomSalt);  
5条回答
  •  天涯浪人
    2020-12-30 10:34

    Always use random salt for each password.

    If you don't then the benefit of having the salt is lost. If you use the same salt , then in the case if website gets compromised , the hacker can use same hash table for hacking all the passwords in your userlist. If salt is random , then he has to have new hashtable for each user.

提交回复
热议问题