如何使用php创建unix密码哈希

Iss*_*lly 1 php unix security passwords hash

我正在尝试安全地创建一个带有PHP脚本的系统用户,在那里,我希望能够使用php脚本散列密码,以便他们的密码在bash历史中无处可见.

如何获取字符串,并将其哈希,以便它是一个unix密码哈希?

$UX_PW = some_function('my_password');
exec("useradd -p $UX_PW newusername");
Run Code Online (Sandbox Code Playgroud)

Dav*_*d Z 5

crypt()实现了UNIX密码散列.
http://us.php.net/manual/en/function.crypt.php