dim $sPath, $ado, $bytes, $MD5, $MD5hashbytes, $x, $hexstring, $bytestohex
$Spath="C:\Downloads\Firefox Setup 46.0.1.exe"
$ADO=createobject("Adodb.Stream")
$ADO.Type=1 ; adTypeBindar
$ADO.Open
$ADO.LoadfromFile($Spath)
$ADO.position=0
$Bytes=$ADO.Read
$ADO.close
$MD5 = CreateObject("System.Security.Cryptography.MD5CryptoServiceProvider")
$MD5.Initialize()
;Note you MUST use computehash_2 to get the correct version of this method, and the bytes MUST be double wrapped in brackets to ensure they get passed in correctly.
$md5hashBytes = $MD5.ComputeHash_2( ($Bytes) )
for $x=1 to lenb($md5hashBytes)
$hexStr= right("0" + hex(ascb(midb( ($md5hashBytes),$x,1))),2)
? $hexstr
$bytesToHex=$bytesToHex + $hexStr
next
? $BytestoHex
Function ASCB($string)
Dim $sc
$sc = CreateObject("ScriptControl")
$sc.Language = "VBScript"
$ASCB = $sc.Eval('ASCB("'+ $String + '")')
EndFunction
Function MidB($string, $start, $length)
Dim $sc
$sc = CreateObject("ScriptControl")
$sc.Language = "VBScript"
$MidB = $sc.Eval('MIDB("'+ $string + '",' + $Start + ',' + $length + ')')
EndFunction
Function LenB($string)
Dim $sc
$sc = CreateObject("ScriptControl")
$sc.Language = "VBScript"
$LenB = $sc.Eval('LenB("'+ $String + '")')
EndFunction
Function Hex($Number)
Dim $sc
$sc = CreateObject("ScriptControl")
$sc.Language = "VBScript"
$Hex = $sc.Eval('Hex('+ $Number + ')')
EndFunction