Digest::MD5 produces a *binary* MD5 hash with md5().  You'll want hex_md5()
or md5_hex(), can't remember which one is the real method.  Pretty sure your
JS function should be doing a hex md5 hash since that's sort of the standard
for JS and PHP.

Also, check your typo - use Digetst::MD5?  If that's in your code... It will
fail.

-Aaron Hawryluk

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of $Bill
Luebkert
Sent: March 22, 2006 7:49 AM
To: Hon Shi
Cc: perl-win32-web@listserv.ActiveState.com
Subject: Re: perl / javascript and MD5

Hon Shi wrote:

> Do these generate the same hash?
> The password fails every time.  

I'd start by printing out the content of $cat and ts.value and see if
they're the same (or similar since they'll be run at different times).  If
that looks OK, proceed to printing $pwhash (at both places) and
pwhash.value.

> Perl version:
> 
>   use Digetst::MD5 qw(md5);
>   $tm = time * 1000;
>   $cat = $password . $tm;
>   $pwhash = md5($cat);  # alternative tried md5($password, $tm);
>   $pwhash = uri_escape($pwhash);
> 
>   then post with
> 
>   do_POST($url_login_post,
>       [ 'ts' => $tm,
>         'encrypw' => $pwhash,
>         'submit1' => 'Login',
>         'text1' => $user_id ]);
>   
> 
> Javascript version:
> 
> <script language="javascript" src"md5.js"></scripts> <script 
> language="javascript"> .
> .
> .
>   ts.value = date.getTime();
>   pwhash.value = calcMD5(password.value + ts.value);
>   fr.submit();
_______________________________________________
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to