1

Topic: How do I encrypt the passwords within PHP?

==== Required information ====
- iRedMail version: 1.8.6
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): mysql
- Linux/BSD distribution name and version: ubuntu 12.04
- Related log if you're reporting an issue:
====


Hello, I'm working on various scripts to migrate users from our two (completely different) old mail platforms. One stage of this requires a bit of work in PHP, the bit I'm having trouble with is encrypting the passwords in a suitable manner to be inserted into the database.

Looking in the tools that come with Ired, I've found this

     export CRYPT_PASSWD="$(openssl passwd -1 ${DEFAULT_PASSWD})"

that's bash and I've been having no luck so far turning it into a PHP query. Would you happen to know the PHP equivalent?

2

Re: How do I encrypt the passwords within PHP?

vmos wrote:

     export CRYPT_PASSWD="$(openssl passwd -1 ${DEFAULT_PASSWD})"

If you try it on terminal, you will get a salted MD5 hash.

Addition info about password hashes used in iRedMail:
http://www.iredmail.org/wiki/index.php? … ord.hashes