I'm having a time banging my head on this one...

Is there anything that would cause :

sub create_checksum { my $self = shift; my $data = shift; my $foo = $$data; use Digest::MD5; my $ctx = Digest::MD5->new; my $cs = $ctx->md5_hex($foo); warn "data: " . $foo; warn "checksum: " . $cs; return $cs; }

From actually giving me different checksum each time it's run?

This seems to be what I'm seeing. If I create a small script that calls just this method in this Module, it seems that everything works correctly, but when I call it from a larger (too large to post) script, it gives me a different checksum!

The only thing I can fathom is that something in the script is mucking about with something in Perl. The only thing out of the ordinary in the script is that it's calliing many time related functions, time() localtime, etc.

Is there anything I should look out for when created Digest::MD5 checksums? I'm on FreeBSD 4.5, perl 5.8, MD5 version 2.22. I've also seen these results using just Digest::Perl::MD5. I'm totally stumped, and I know that this isn't much to go by, but that's my problem too.

Is there something I"m just totally missing? I'm not really a green thumb with this Perl thing...

Cheers,

 

-justin simoni
!skazat!


In reply to MD5 Peculiarities by skazat

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.