Encrypting Passwords

From: Date: Sat, 30 Dec 2000 21:38:18 +0000
Subject: Encrypting Passwords
Groups: php.general 
Request: Send a blank email to php-general+get-32358@lists.php.net to get a copy of this message
An example line of my /etc/shadow is oltest:$1$scWuGnwQ$u11q3QKMB8m4H00U3WJvY1:11318:0:99999:7::: The password part of that line being "$1$scWuGnwQ$u11q3QKMB8m4H00U3WJvY1" I need to work out how to generate such encrypted passwords from within PHP itself, for the following reason: - I'm writing a PHP shell script that will be run by an admin and will add users and simultaneously add their details to a database - I will be using the 'useradd' unix command which takes a "-p" option. However, the password supplied to -p must be *pre-encrypted* The man page for useradd mentions using the crypt C function, but I can't see how to do that in relation to PHP. From the PHP function manual on crypt "CRYPT_MD5 - MD5 encryption with a 12-char SALT starting with $1$ " seems to be what I should be looking at, but after a bit of trouble I still can't get what I want. For starters, how do I know what to use for salt. What does the unix passwd command use for salt? I hope someone will be able to help me some! Thanks very much, Ollie --- Do radioactive cats have 18 half-lives? http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x53D29567 ---

« previous php.general (#32358) next »