To further your cause for information, it might help if you showed Perl/Digest::MD5 and md5sum producing different results. Eg. c&p the shell output.

That would show which combination is producing the wrong results.

Given sisyphus' recent problems with using integers on 64-bit platforms, one possibility is the conversion of the 128-bit integer to hex there has issues.

Another possibility is that you aren't binmodeing the file before reading it. A more common mistake on win32, but with the advent of unicode, maybe that is affecting the results?

Example: The first perl command doesn't binmode the file, the second does:

C:\test>perl -MDigest::MD5=md5_hex -wle"print md5_hex( do{local $/; <> } )" 1Mx4096.db 22502b12bc292ae0a0aa1f4a33942662 C:\test>perl -MDigest::MD5=md5_hex -wle"open I, '<:raw', $ARGV[ 0 ]; print md5_hex(do{local $/; <I>})" 1M +x4096.db 66bff1dfd44db7d4402171056d494b2d C:\test>md5sum 1Mx4096.db 66bff1dfd44db7d4402171056d494b2d *1Mx4096.db

Update: As ikegami alludes to below, in the light of Using ":raw" layer in open() vs. calling binmode(), whether it's broken documentation or a bug in PerlIO, it seems that you need '<:raw:perlio' to achieve the same as binmode via open, which is important if performance is a consideration.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re: Digest::MD5::md5_hex giving different values on different machines by BrowserUk
in thread Digest::MD5::md5_hex giving different values on different machines by leocharre

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.