We have a paid service and we need to have a script that encrypts passwords. We don’t want to use the one going through the website:

How or where can we do this? what kind of ecryption is being used? what script is being run when doing a password encryption?

This describes doing it in shell:


However you can do the same thing in Perl using the crypt function:


Which is also in PHP of course:

:cool: Perl / MySQL / HTML CSS


this is what’s happening,

i crea a very simple script using crypt()

and it gives me a MD5 encryption instead of a standrda DES encryption.

this is the script:

<?php $pass = crypt('testing'); print($pass) ?>

this is what i get:

however if i use the smae script but with ‘lm’ in crypt :

<?php $pass = crypt('testing', 'lm'); print($pass) ?>

i get this:

whic is the type of encrypt I need but not using ‘lm’ always, instead being random.

help pleaseeee?

It is explained in the PHP documentation, here is the excerpt:

" If the salt argument is not provided, one will be randomly generated by PHP each time you call this function.

Some operating systems support more than one type of encryption. In fact, sometimes the standard DES-based encryption is replaced by an MD5-based encryption algorithm. The encryption type is triggered by the salt argument. At install time, PHP determines the capabilities of the crypt function and will accept salts for other encryption types. If no salt is provided, PHP will auto-generate a standard two character salt by default, unless the default encryption type on the system is MD5, in which case a random MD5-compatible salt is generated. PHP sets a constant named CRYPT_SALT_LENGTH which tells you whether a regular two character salt applies to your system or the longer twelve character salt is applicable. "

But is your question really how to pick to characters randomly? That is demonstration in the Perl documentation:$salt = join '', ('.', '/', 0..9, 'A'..'Z', 'a'..'z')[rand 64, rand 64]

:cool: Perl / MySQL / HTML+CSS