Encryption

software development

#1

Hi,

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:
https://panel.dreamhost.com/index.cgi?tree=goodies.webdav&

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


#2

This describes doing it in shell:

http://httpd.apache.org/docs/1.3/howto/auth.html#basicconfig

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

http://perldoc.perl.org/functions/crypt.html

Which is also in PHP of course:
http://www.php.net/manual/en/function.crypt.php

:cool: Perl / MySQL / HTML CSS


#3

HI,

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:
$1$HdWAbDT6$rgnPhDx/W7Jx9fUvj7sza1

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

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

i get this:
lmG4Ra0HAmcsc

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

help pleaseeee?


#4

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