How do I create a unix password hash with php
问题 I'm trying to create system users with a php script securely, In that, I'd like to be able to hash the password with the php script, so that their password shows up nowhere in the bash history. How to I take a string, and hash it so it is a unix password hash? $UX_PW = some_function('my_password'); exec("useradd -p $UX_PW newusername"); 回答1: It's crypt() that implements the UNIX password hashing. http://us.php.net/manual/en/function.crypt.php 回答2: Depending on your system, you're either