Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Calc md5 for file by drag and drop (Windows)

by fizbin (Chaplain)
on Oct 18, 2005 at 07:22 UTC ( [id://500899]=note: print w/replies, xml ) Need Help??


in reply to Calc md5 for file by drag and drop (Windows)

A nice enhancement of this would be to see if the current Clipboard text matched /^\s*[a-f\d]{32}\s*$/i and, if so, popping up a nice MsgBox saying whether the file dropped had the same md5 as what was in the clipboard.

Or something more elaborate, such as parsing the clipboard text for stuff that looks like:

MD5 (example_1) = bea8252ff4e80f41719ea13cdf007273 MD5 (example_2) = e0675e728056818b0392c0c2f5478ff0
(Or whatever format is used by the md5 program all the cool kids are using these days) And then forming relative filenames so that one just has to copy a chunk of MD5 statements like the above, and drag one of the files in the directory over onto the icon.

Note that another fine use of the script as-is is to drop a shortcut to it in one's SendTo folder in the %USERPROFILE% directory, or added to the context menu of every file by loading a registry file such as:

Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell] [HKEY_CLASSES_ROOT\*\shell\Calc MD5] [HKEY_CLASSES_ROOT\*\shell\Calc MD5\command] @="C:\\Perl\\Perl.exe c:\\where\\ever\\CalcMD5.pl \"%1\""

Update: I've now gone and investigated the output of various md5 utilities, and have this to report:
  • md5sum on most linux distributions produces this format: (i.e. two spaces)
    9c4ec476409f3a02f3ffb337a91cb65f mud.el
  • md5 on my Debian box does this:
    9c4ec476409f3a02f3ffb337a91cb65f mud.el
    where what's between the sum and the filename is a single character number 9. (tab)
  • md5sum on BSD boxes does this:
    MD5 (will.zip) = 9c05488e1ccfe1b77c33b12706fa8151

Hopefully, covering that mess will cover all that's needed.

--
@/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/; map{y/X_/\n /;print}map{pop@$_}@/for@/

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-24 01:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found