perl / javascript and MD5
Do these generate the same hash? The password fails every time. 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 srcmd5.js/scripts script language=javascript . . . ts.value = date.getTime(); pwhash.value = calcMD5(password.value + ts.value); fr.submit(); Thanks __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ Perl-Win32-Web mailing list Perl-Win32-Web@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
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 srcmd5.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
RE: perl / javascript and MD5
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 srcmd5.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
Simon YEE/NYP/SINGOV is out of the office.
I will be out of the office from 15/03/2006 to 28/03/2006. Thank you for the email. I shall respond as soon as I get back to the office. For Part Time Diploma in Engineering Informatics, please contact Mr Koh Choon Chye at 6550-0615 or email him at [EMAIL PROTECTED] Regards. ___ Perl-Win32-Web mailing list Perl-Win32-Web@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs