Can you convert the output of php crypt() to valid MD5?

后端 未结 5 1682
天涯浪人
天涯浪人 2020-12-28 23:48

I have some strings that have been encrypted using the PHP function crypt().

The outputs look something like this:

$1$Vf/.4.1.$CgCo33ebiHVuFhpwS.kMI0         


        
5条回答
  •  庸人自扰
    2020-12-29 00:30

    $1$ indeed means that this is a MD5 hash, but crypt generates a random salt. This is why you find a different MD5 value. If you include the generated salt you will find the same result.

    The salt is base64 encoded in the output, as the hash.

    The algorithm used is a system wide parameter. Generally this is MD5, you are right.

提交回复
热议问题