The XHTML WYSIWYG Editor For Desktop & Web Applications

MD5 Component

Overview

The MD5 component uses the industry-standard MD5 checksum algorithm to get a fingerprint of a file. If you are storing files in a database, this component is a must. To avoid storing duplicate files in the database, store the MD5 checksum along with the file in the database. Every time you save a file, take an MD5 of the file and compare it to the list of MD5s stored in the database to see if this file is already stored. This component can be used in environments that support COM such as Active Server Pages, Windows Scripting Host, Visual Basic, etc.

License
Freeware
Type
ActiveX DLL for 32 bit OS
Version
1.0
File Name
XMD5.dll
Download Package
x-md5.zip

Download

Download MD5 Component

Installation Instructions

  1. Move the dll to a directory like: C:\Program Files\XStandard\Bin\.
  2. Open a command prompt and cd to the directory where the dll is located.
  3. Type regsvr32 XMD5.dll
  4. Grant "Read & Execute" file permissions on this dll to Everyone.

Note, on Microsoft Vista, the command prompt must be "Run as administrator" as shown in the screen shot below.

Context menu for the command prompt showing the option to run as administrator.

Uninstall Instructions

  1. Open a command prompt and cd to the directory where the dll is located.
  2. Type regsvr32 -u XMD5.dll

API Reference: ProgID: XStandard.MD5

Function GetCheckSumFromFile(sPathName As String) As String

Return checksum of a file

Function GetCheckSumFromString(sString As String) As String

Return checksum of a string

Examples

The examples below are for Active Server Pages. For Windows Scripting Host or Visual Basic, replace Server.CreateObject with CreateObject and replace Resonse.Write with MsgBox.

Check if two files are identical

  1. <%
  2. Dim objMD5, strFingerPrint1, strFingerPrint2
  3. Set objMD5 = Server.CreateObject("XStandard.MD5")
  4. strFingerPrint1 = objMD5.GetCheckSumFromFile("C:\Temp\file1.jpg")
  5. strFingerPrint2 = objMD5.GetCheckSumFromFile("C:\Temp\file2.jpg")
  6. If strFingerPrint1 = strFingerPrint2 Then
  7. Response.Write "Files are identical!"
  8. Else
  9. Response.Write "Files are different!"
  10. End If
  11. Set objMD5 = Nothing
  12. %>