MD5 is pretty strong; I hope you're calling a C function for that. VB6 is terrible at hashing, especially since there's no shift operator. I'm just wondering if you need to hash at all. Let's see, if all you need to do is check if any of the properties have changed, then perhaps just adding the attributes mask and the sizes would accomplish what you need, but much faster. Thus, if any of the properties change, the sum will change too. The odds of a change plus an inverse numeric change are extremely improbable, so it seems doable. It's not like you're doing a checksum.
If you planned on processing the entire file's guts with MD5, then there would be no need to check attributes, but it would take forever. It would be a very reliable way to check for tampering, though, since otherwise you won't be able to check for same-size alterations, where the hacker is sharp enough to restore the file's modification time.
I must admit, there's not much to hash with file attributes (all in a single integer), but it's easy to grab all 3 file times using the Win32 API:
Private Const FILE_SHARE_READ = 1
Private Const OPEN_EXISTING = 3
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Private Declare Function GetFileTime Lib "kernel32" Alias "GetFileTime" (ByVal hFile As Long, pCreationTime As FILETIME, pLastAccessTime As FILETIME, pLastWriteTime As FILETIME) As Long
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal pFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, pSecurityAttributes As SECURITY_ATTRIBUTES, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObj As Long) As Long
Sub GetTimes(sFilePath As String)
Dim ftCreat As FILETIME
Dim ftAccess As FILETIME
Dim ftWrite As FILETIME
Dim hFile As Long
Dim lSuccess As Long
hFile = CreateFile(sFilePath, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0)
If hFile = INVALID_HANDLE_VALUE Then
Exit Sub 'failure
End If
lSuccess = GetFileTime(hFile, ftCreat, ftAccess, ftWrite)
Call CloseHandle(hFile)
If lSuccess = 0 Then Exit Sub 'failed
'do what you want with file times...
End Sub
Your project sounds really cool, as you can tell by my interest :)
Cheers