The DAM Forum
Welcome, Guest. Please login or register.
April 22, 2018, 08:51:03 PM

Login with username, password and session length
Search:     Advanced search
28033 Posts in 5147 Topics by 2906 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 4049 times)
Jr. Member
Posts: 52

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

I had posted a note here:

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).

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!