Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Pure Perl implementation of Digest::MD5?

by izy_t (Novice)
on Oct 25, 2003 at 12:34 UTC ( [id://302052]=perlquestion: print w/replies, xml ) Need Help??

izy_t has asked for the wisdom of the Perl Monks concerning the following question:

Has anyone got a working version of a perl implemented md5?

I have been using the perl interface to the C md5 (Digest::MD5), but I need a version implemented in perl for a CGI script. I've tried 2 modules on CPAN, but I couldn't get them to work. I would be very grateful if someone could point me in the right direction.

thanks, Izy_t

20031025 Edit by Corion: Changed title from 'md5?', added formatting

  • Comment on Pure Perl implementation of Digest::MD5?

Replies are listed 'Best First'.
Re: Pure Perl implementation of Digest::MD5?
by Taulmarill (Deacon) on Oct 25, 2003 at 13:05 UTC
    hm, i searched at search.cpan.org for "pure perl md5". oh, and look what i found, Digest::MD5::Perl
    itīs "not an interface (like Digest::MD5) but a Perl implementation of MD5".
Re: Pure Perl implementation of Digest::MD5?
by batkins (Chaplain) on Oct 25, 2003 at 13:06 UTC
    Did you try Digest::Perl::MD5? It would be helpful if you told us what modules you tried, so we'd at least know where to start.

    The computer can't tell you the emotional story. It can give you the exact mathematical design, but what's missing is the eyebrows. - Frank Zappa
      I tried both the Digest::Perl::MD5 modules that you get by a search for "MD5" on cpan (one by Steve A Fink and the other by Christian Lackas). I could get neither of them to work.
        Well..........what happened?

        The computer can't tell you the emotional story. It can give you the exact mathematical design, but what's missing is the eyebrows. - Frank Zappa
Re: Pure Perl implementation of Digest::MD5?
by ptkdb (Monk) on Oct 25, 2003 at 14:51 UTC
    Are you expecting alot of traffic and MD5 checking on this site? MD5 is a VERY intensive block of calculations. The perl version promises to be much much slower than the C based version.

    Things may look fine for a couple of simple test sessions against the server, but when you start to load things up that will change quickly.

    Your best bet might be to update your CGI installation such that Digest::MD5 is included.

      I'm using a demon server which is shared with other users, I don't think I can install and run the C based md5. It is only needed for hashing 8 characters or so of password. When I tried one of the perl based md5, the server still looked in @inc (which I do not have access to) for the md5.pm file. And when I tried the other one, I got an error:

      "Can't locate object method "new" via package "MD5" at..."

        MD5 processes data in blocks of 64 bytes(512 bits). If you have less than 64 bytes(53 actually since there is padding that has to be done on the last 'bit' and a quad-word added for length at the end) it gets padded out to 64 bytes anyway.
Re: Pure Perl implementation of Digest::MD5?
by izy_t (Novice) on Jan 03, 2004 at 15:39 UTC
    Thanks everyone. I eventually got it working... I ended up using the perl implementation of md5 from cpan The instructions given on cpan tell you to use:
    use Digest::MD5; $ctx = Digest::MD5->new;
    but that would not work, and a bit of trial and error brought to me this:
    use MD5; $ctx = Digest::Perl::MD5->new;
    which now works well. I don't know why their instructions didn't work down my end, but if I got it wrong, how and why? And if it is wrong on cpan, does the author need telling?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://302052]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-25 06:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found