Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Checksum for Windows

by tachyon (Chancellor)
on Jul 21, 2003 at 13:08 UTC ( #276255=note: print w/ replies, xml ) Need Help??


in reply to Checksum for Windows

System independent.....

#!/usr/bin/perl use Digest::MD5 'md5_hex'; undef $/; open F, $ARGV[0] or die "Usage $0 <file>\n$!\n"; binmode F; print md5_hex(<F>); close F;

Update

Added binmode for Win32, Mac as suggested by particle

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


Comment on Re: Checksum for Windows
Download Code
Re^2: Checksum for Windows
by particle (Vicar) on Jul 21, 2003 at 18:00 UTC

    although i haven't tested, this looks suspiciously like a case where binmode might be necessary.

    as it stands, it can also be written as a one-liner, like

    perl -000 -MDigest::MD5=md5_hex -ne"$\=md5_hex}{print" your_file_here

    note the triple-zero option to undefine the output line seperator.

    ~Particle *accelerates*

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://276255]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2015-07-06 00:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (68 votes), past polls