Why is the PHP crypt() function returning the same thing for two different strings?

后端 未结 3 1946
栀梦
栀梦 2021-01-22 23:49

I\'m using PHP\'s crypt function for password hashing/encryption, but I don\'t think I am doing it right because \"nathan12\" and \"nathan123\" both allow me to log

3条回答
  •  隐瞒了意图╮
    2021-01-23 00:44

    The standard DES-based crypt() [...] only uses the first eight characters of str, so longer strings that start with the same eight characters will generate the same result (when the same salt is used).

    source

    Use a salt that starts with $$ to use something other than DES. See the crypt() documentation for details.

提交回复
热议问题