Thanks for sharing!

Just an observation, which may not be relevant, since your script's output format doesn't exactly match that of md5sum (you include the file's size):

md5sum offers a -b switch, which mainly adds the "b" to the fopen call, which "has no effect; the 'b' is ignored on all POSIX conforming systems, including Linux." It also adds an asterisk to the output line to indicate that the binary mode was used, like so:

$ md5sum -b * fb8d98be1265dd88bac522e1b2182140 *foo.txt f83a0aa1f9ca0f7dd5994445ba7d9e80 *bar.txt d6a6bc0db10694a2d90e3a69648f3a03 *quz.txt

But in my experience people usually ignore the -b switch because it has no effect on those systems. On Windows, of course it's a different story, since there, fopen cares about the "b" mode (among other things, "translations involving carriage-return and linefeed characters are suppressed").

Now whether or not this is an issue at all depends on whether there's a Windows MD5 checksumming tool that defaulted to reading files in text mode. But since you're on Windows and you use binmode, if you felt like making your output more similar to that of md5sum, you could consider adding the asterisk to your output.


In reply to Re: MD5 checksums for Windows by Anonymous Monk
in thread MD5 checksums for Windows by golux

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.