Generate-an-MD5-hash-of-a-file-from-your-program - WeOnlyDo Software example code



All

wodCrypt (12)
wodSSH (10)
wodSFTP (23)
wodSSHServer (1)
wodSSHTunnel (11)
wodSSHpackage
wodSFTPdll

wodSSH.NET (10)
wodSFTP.NET (24)
wodFtpDLX.NET (22)
wodWebServer.NET (10)

wodAppUpdate (13)
wodHttpDLX (8)
wodFtpDLX (22)
wodTelnetDLX
wodFTPServer (3)
wodWebServer (10)
wodVPN
wodXMPP (13)
All ** [Visual Basic] ** [C#] ** [VB.NET] **

Generate an MD5 hash of a file from your program
VB code
'The first step is to declare and initialize the objects that we will use to achieve our goal.
Dim wodCrypt As wodCryptCom
Dim InFile As FileBlob
Dim hash As FileBlob
   
Set wodCrypt = New wodCryptCom
Set InFile = New FileBlob
Set hash = New FileBlob

' point our component to the file for which a hash is to be calculated, and set its digest to MD5
InFile.FileName = "c:\windows\notepad.exe"
wodCrypt.Type = MD5

'Once we have selected the file to calculate, and set the digest we want to use, we can perform the actual calculation.
wodCrypt.Digest InFile, hash

'The calculation is done in one method, Digest,
'and the calculated value is stored into a special WODCRYPTCOMLib.Blob object called "hash".
'The application will then show the result in a message box window using the ToHex() method of the hash object.
MsgBox hash.ToHex