To make this even more simpler to understand, here is a module, called, "CheckSum.pm":

package MOJO::MailingList::Schedules::CheckSum; sub new { my $class = shift; my %args = (@_); my $self = {}; bless $self, $class; return $self; } use Digest::MD5; sub checksum { my $self = shift; my $data = shift; my $ctx = Digest::MD5->new; return $ctx->md5_hex("foobarbaz"); } 1;

(NOTE: it will always make the checksum from "foobarbaz" )Here is a script that tests this module:

require MOJO::MailingList::Schedules::CheckSum; my $cs = MOJO::MailingList::Schedules::CheckSum->new(); print $cs->checksum("foobarbaz") ."\n";

That script prints out, "d79e1dc81fb80407e0824bf7854b7544",

When almost the exact code is put into another script:

sub create_checksum { my $self = shift; my $data = shift; require MOJO::MailingList::Schedules::CheckSum; my $cs = MOJO::MailingList::Schedules::CheckSum->new(); return $cs->checksum("foobarbaz") ."\n"; }

this returns all sorts of things, a few of the checksums I've received:

203156774c6b5b2300971c5abed8f0d6
46b8a55039b48cac0955106b0987a3d
6f0e7e2d63ce536cc381698a9f6a9524

I'm pretty stumped on why I'm receiving this. Oy.. It must be because of something else in that module, but what? and why? Again, I would post the module, but it's almost 800 lines long and the script that calls it is 1500.

 

-justin simoni
!skazat!


In reply to Re: MD5 Peculiarities by skazat
in thread 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.