hesco has asked for the wisdom of the Perl Monks concerning the following question:
It all works just fine when I'm using plain text passwords. But when I try to encrypt the passwords with md5, the whole thing breaks down pretty quick.
Relevant code from my CGI::App module:
and my latest experiment with the code which creates the user who's password is tested:use CGI::Application::Plugin::Authentication; use CGI::Application::Plugin::Authentication::Driver::Filter::md5; DistroPrsRls->authen->config( DRIVER => [ 'DBI', DBH => $authdb, TABLE => 'userdb', CONSTRAINTS => { 'userdb.username' => '__CREDENTIAL_1__', 'MD5:userdb.password' => '__CREDENTIAL_2__' # 'userdb.password' => '__CREDENTIAL_2__' }, ], STORE => 'Session', POST_LOGIN_RUNMODE => 'login_welcome', POST_LOGIN_CALLBACK => \&update_login_date, CREDENTIALS => [ 'authen_username', 'authen_domain', 'authen_passwor +d' ], LOGIN_SESSION_TIMEOUT => { IDLE_FOR => '5m', EVERY => '1h' }, );
I seem to have more options for how to encrypt it at the time of creation. I have found fewer models for how to encrypt the login password which gets checked against the database.use DBIx::UserDB; use DBIx::SearchProfiles; use Digest::MD5 qw(md5_hex); sub CreateUser { my($userdb,$username,$password)=@_; print STDERR "Running Create User Subroutine.\n"; # store md5 hash of password my $digest = md5_hex($password); # my $string = MD5->hexhash($password); my $user = { username => $username, password => $digest }; $user = $userdb->user_create( $user ); return; }
But as these two tools are not quite written to interface with one another, I'd appreciate some guiance on how to make them play nice.
Any ideas?
-- Hugh
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: comparing md5 hashed passwords
by cees (Curate) on Feb 16, 2006 at 15:27 UTC | |
|
Re: comparing md5 hashed passwords
by hesco (Deacon) on Feb 16, 2006 at 20:03 UTC |