This works like a charm, authenticating plain text tokens. But I haven't been able to figure out how to get it to work against digested passwords.

I must be missing something here:

mysql> select uid, username, password from userdb; +-----+------------+------------------------------------------------+ | uid | username | password | +-----+------------+------------------------------------------------+ | 2 | hesco | password | | 35 | md5 | 05;X@9WL<JL&TU3!8@`L&[P`` | | 36 | md5_hex | @-35B93(P-C<W8C%C86%C,6(T9#4S,#4X.#`P8C`V968` | | 37 | md5_base64 | 65F(T9UHS<V-Q<T<P,51"66=!<T<W=P`` | +-----+------------+------------------------------------------------+ 4 rows in set (0.00 sec)
I'm using some code that wraps around DBIx::UserDB to build and manipulate a database of authentication keys. I want to access those tables with the CGI::Application::Plugin::Authentication to guard the entrance to applications built behind that front door.

The four users above all have the password "password", encoded, to the best of my knowledge using the method indicated by their username. I changed this line of code in the CreateUser subroutine to make the changes.

sub CreateUser { my($userdb,$username,$password)=@_; print STDERR "Running Create User Subroutine.\n"; # store md5 hash of password # my $digest = md5($password); # my $digest = md5_hex($password); # my $digest = md5_base64($password); # my $user = { username => $username, password => $digest }; my $user = { username => $username, password => $password }; $user = $userdb->user_create( $user ); return; }
I changed this line of code in the DRIVER definition to test my ability to connect.
DRIVER => [ 'DBI', DBH => $authdb, TABLE => 'userdb', CONSTRAINTS => { 'userdb.username' => '__CREDENTIAL_1__', 'userdb.password' => '__CREDENTIAL_2__' # 'MD5:userdb.password' => '__CREDENTIAL_2__' # 'MD5_hex:userdb.password' => '__CREDENTIAL_2__' # 'MD5_base64:userdb.password' => '__CREDENTIAL_2__' }, ],
Is there some other way I should be doing this?

-- Hugh


In reply to Re: comparing md5 hashed passwords by hesco
in thread comparing md5 hashed passwords by hesco

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.