Dear Monks,

I need help with the syntax for salting a password using CGI::Application::Plugin::Authentication and Digest::MD5.

1. the password is entered by the user
2. the salt found in TableB is added
3. the salt and the password are MD5 encrypted
4. the results are then to be compared to the salted password already in TableA
(The salt is in TableB and the md5 salted password is in TableA -- joined on column2.)

I believe that I need to use a custom filter. I've read and re-read the CPAN examples but I still can't "get it". Any help or links to other examples would be appreciated.

TABLES => ['column1 TableA, 'column1 TableB'], JOIN_ON => 'TableA.column2 = TableB.column2', CONSTRAINTS => { 'TableA.username' => '__CREDENTIAL_1__', 'md5_base64:salt:password' => '__CREDENTIAL_2__', 'TableB.column3' => __CREDENTIAL_3__', } FILTERS => { salt => \&salt_filter }, ], sub salt_filter { my $param = shift; my $value = shift; $value = $dbh->prepare ("SELECT salt FROM TableB JOIN TableA ON TableB.column2 = TableA.column2 "); return $value; }

In reply to How to use salt with CGI::Application::Plugin::Authentication by Anonymous Monk

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.