Looking to create a function using MD5 as an iMan function? (1 reply)
Lisa, our recommended approach would be to create a Common Function to calculate the MD5 hash of a given file, then you could compare the result of the function the file path.
Function CompareMD5Hash(sFilePath)
Dim MD5
Dim bContents
Dim inStream
Set inStream = CreateObject("ADODB.Stream")
inStream.Open
inStream.Type = 1
inStream.LoadFromFile CStr(sFilePath)
bContents = inStream.Read
Set MD5 = CreateObject("System.Security.Cryptography.MD5CryptoServiceProvider")
MD5.Initialize
bContents = MD5.ComputeHash_2((bContents))
CompareMD5Hash = Base64EncodeBinary(bContents)
End Function
We have a process where we grab a PDF file from ftp but we need to verify the file is viable and complete. We were able to successfully create this ‘check’ in visual studio and hoping to use this or something similar as a function in IMan. We hard-coded the filepath here but this would be a parameter. Basically we are comparing the MD5 extracted to the MD5 stored in the file name.
The file name is:
C:/temp/13759007064.md58052856ACE07622625330F7F77FC1777.pdf