The DAM Forum
Welcome, Guest. Please login or register.
November 26, 2014, 12:37:45 AM

Login with username, password and session length
Search:     Advanced search
28021 Posts in 5141 Topics by 2910 Members
Latest Member: kbroch
* Home Help Search Login Register
+  The DAM Forum
|-+  Software Discussions
| |-+  Scripting
| | |-+  Calculating MD5 for verifying data integrity
« previous next »
Pages: [1] Print
Author Topic: Calculating MD5 for verifying data integrity  (Read 2815 times)
matthewjheaney
Jr. Member
**
Posts: 52

674071051 matthewjheaney@msn.com matthewjheaney matthewjheaney
View Profile Email
« on: April 12, 2008, 11:24:48 AM »

I had posted a note here:

http://thedambook.com/smf/index.php?topic=2650.msg17619#msg17619

regarding a technique for calculating MD5 hash values for a file.  There I was using fciv.exe (a Windows utility from Microsoft), run as a shell process from the script, something like:

Set execObj = WshShell.Exec("fciv -wp """ & item.path & """")

I finally learned enough COM Automation to write a component that can be loaded directly from the script.  So I can now do this (in vbscript):

    Dim md5, val
    Set md5 = CreateObject("MJH.MakeMD5")
    val = md5.CalculateMD5(item.path)

which returns a BSTR representing the 32 hex characters of the MD5 value.  It would work the same in j(ava)script:

   var md5 = new ActiveXObject("MJH.MakeMD5");
   var val = md5.CalculateMD5(item.path);

For those of you using xMedia (really, any scriptable image browser or asset management tool), you could use this to set the value of a custom field when you populate the catalog, and then later compare the current MD5 hash of a file to the value you've stored in the catalog, to determine whether the file has been modified (say, because of degradation of the media).

Cheers,
Matt
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!