Passwords are hashed using the library functioncrypt(3); see the manual page for crypt(3). The function chooses the encryption function based on the format of the salt:

  • $1$salt_chars$: use MD5
  • $2a$salt_chars$: use Blowfish (not standard, most likely not available)
  • $5$salt_chars$: use SHA-256
  • $6$salt_chars$: use SHA-512
  • Not in the form $type$salt_chars$: use DES as in the old days.

I have no idea if you can use PHP to emulate exactly what crypt(3) does.