RE: [PEAR-DEV] Auth - DB_Crypt - any interest?
| From: | Martin Jansen | Date: | Mon, 11 Mar 2002 13:24:05 +0000 |
| Subject: | RE: [PEAR-DEV] Auth - DB_Crypt - any interest? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-4954@lists.php.net to get a copy of this message | ||
On Mon, 11 Mar 2002 11:57:56 +0100 (CET), Hans Westerbeek wrote:
>Anyway I need support for several cryptotypes as well. How about using DES
>as default and adding a setCryptoType() method?
>I'd be happy to implement it, but let's agree on the interface first.
I've also thought about having something like that. I think
we could do it like that:
Container/DB.php:
======================================================================
var $cryptType = "md5";
function setCryptType($type = "md5")
{
$this->cryptType = $type;
}
function validatePassword($password1, $password2)
{
switch ($this->cryptType) {
case "crypt" :
/** do crypt encryption here */
case "md5" :
default :
$password1 = md5($password1)
}
if ($password1 == $password2) {
return true;
} else {
return false;
}
}
======================================================================
If you want to implement this, you can send me the diffs.
- Martin
--
Martin Jansen, <mail@martin-jansen.de>
http://www.martin-jansen.de/