Hi there,
I'm currently having an issue with using a BackgroundWorker to generate SHA1 hashes from a file list.
Its getting through 18 files before stopping (9677 Files in the list) :(
Any help would be epicsause!
Imports:
Hashing Method:
And Finally the BackgroundWorker:
Output:
E5-07-48-BA-24-A9-8F-2A-96-BE-BE-53-43-20-A8-9E-F8-F4-73-85 BB.exe
8D-0A-FA-78-89-3A-E5-F0-4E-50-5D-B0-D7-6D-0D-50-CF-34-E7-DA floppy.exe
E2-71-74-A1-17-96-86-3C-F1-4A-9E-16-54-B3-DD-4F-94-0E-DE-27 dictionary.xml
73-4F-69-2B-48-38-A2-D0-E2-93-6A-22-4D-EF-FF-D1-F6-E8-50-60 Directories.xml
09-F4-94-07-D0-E1-54-C0-69-53-B1-91-C6-E1-E0-85-B1-DE-5C-7D Formats.xml
71-BF-D8-85-E3-A6-B6-1B-41-DA-FB-54-76-46-3D-63-CF-FB-67-BA 28551931.png
17-27-7A-86-A8-BB-7E-A7-4F-00-D2-95-CF-22-1D-E5-58-58-06-F8 abw11220aus.exe
CB-9E-95-52-0F-6E-B8-09-66-88-8C-9E-24-3A-87-EE-E0-0E-EB-08 Adaware_Installer.exe
AB-69-CF-FE-7D-15-A4-73-D3-28-A5-93-F4-9F-ED-85-F5-DD-63-29 AdobeDownloadAssistant.exe
6C-9A-EE-E0-7E-7D-7E-B0-AC-63-17-F4-07-03-9D-F1-1B-8A-37-8C avc-ultimate.exe
71-5C-7E-D3-07-18-22-BC-00-95-90-4D-99-8A-26-55-2F-FA-9C-96 avidemux_2.6.3_32bits.exe
FA-7F-C4-F1-FF-0A-DA-AF-41-90-E6-55-A7-94-62-29-0A-1A-80-9D BarcodeR11.exe
88-93-5F-13-D2-3B-60-16-E2-8E-09-1F-FC-08-0E-DD-30-13-C7-42 bsdkw30016eu.exe
33-C7-6A-B5-48-BE-BD-D7-F6-EA-45-62-73-F0-5A-E4-1E-9E-B3-68 CamStudio_Setup_v2.6b_r294_(build_24Oct2010).exe
6A-77-BB-40-F3-84-CD-BC-DB-52-0B-07-65-02-94-59-AD-D7-8F-CF ca_setup.exe
0A-58-F8-40-0A-1B-F3-E8-D1-F2-F7-6A-E2-93-02-DC-04-CC-03-4C ccsetup324_pro.exe
7D-15-E5-92-6C-95-48-B3-4C-EA-07-4C-15-8E-E5-30-1B-02-31-F1 ChromeSetup.exe
64-CC-CB-84-BF-05-E2-FA-AF-60-E1-FC-1C-38-E9-0E-73-8E-CE-E8 diptrace_en.exe
PWEEEZE HALP
I'm currently having an issue with using a BackgroundWorker to generate SHA1 hashes from a file list.
Its getting through 18 files before stopping (9677 Files in the list) :(
Any help would be epicsause!
Imports:
Code:
#Region "Imports"
Imports Microsoft.Win32
Imports System
Imports System.IO
Imports System.Security.Cryptography
Imports System.Text
Imports System.Text.Encoding
Imports System.Xml
#End Region
Code:
'Create HASH
Function GetHASH(ByVal File_Path As String)
Dim sHash As String = ""
Dim MyStreamReader As StreamReader = New StreamReader(File_Path)
Dim MyHASH As SHA1CryptoServiceProvider = New SHA1CryptoServiceProvider
sHash = BitConverter.ToString(MyHASH.ComputeHash(MyStreamReader.BaseStream))
MyStreamReader.Dispose()
Return sHash
End Function
Code:
Private Sub BGW_Generate_HASH_DoWork(sender As System.Object, e As System.ComponentModel.DoWorkEventArgs) Handles BGW_Generate_HASH.DoWork
Dim QueSize As Integer = FoundFiles.Count
Dim QueProcessed As Integer = 0
Dim OnePercent As Integer = QueSize / 100
For Each fi In FoundFiles
Try
If XDim = True Then
ReDim Preserve FileHashes(0 To UBound(FileHashes) + 1)
Else
ReDim FileHashes(0 To 0)
XDim = True
End If
FileHashes(UBound(FileHashes)) = GetHASH(fi.FullName)
QueProcessed = QueProcessed + 1
BGW_Generate_HASH.ReportProgress(QueProcessed / OnePercent)
Debug.Print(GetHASH(fi.FullName) & " " & fi.Name)
Catch ex As Exception
MsgBox(ex.Message)
End Try
Threading.Thread.Sleep(150)
Next
End Sub
Quote:
E5-07-48-BA-24-A9-8F-2A-96-BE-BE-53-43-20-A8-9E-F8-F4-73-85 BB.exe
8D-0A-FA-78-89-3A-E5-F0-4E-50-5D-B0-D7-6D-0D-50-CF-34-E7-DA floppy.exe
E2-71-74-A1-17-96-86-3C-F1-4A-9E-16-54-B3-DD-4F-94-0E-DE-27 dictionary.xml
73-4F-69-2B-48-38-A2-D0-E2-93-6A-22-4D-EF-FF-D1-F6-E8-50-60 Directories.xml
09-F4-94-07-D0-E1-54-C0-69-53-B1-91-C6-E1-E0-85-B1-DE-5C-7D Formats.xml
71-BF-D8-85-E3-A6-B6-1B-41-DA-FB-54-76-46-3D-63-CF-FB-67-BA 28551931.png
17-27-7A-86-A8-BB-7E-A7-4F-00-D2-95-CF-22-1D-E5-58-58-06-F8 abw11220aus.exe
CB-9E-95-52-0F-6E-B8-09-66-88-8C-9E-24-3A-87-EE-E0-0E-EB-08 Adaware_Installer.exe
AB-69-CF-FE-7D-15-A4-73-D3-28-A5-93-F4-9F-ED-85-F5-DD-63-29 AdobeDownloadAssistant.exe
6C-9A-EE-E0-7E-7D-7E-B0-AC-63-17-F4-07-03-9D-F1-1B-8A-37-8C avc-ultimate.exe
71-5C-7E-D3-07-18-22-BC-00-95-90-4D-99-8A-26-55-2F-FA-9C-96 avidemux_2.6.3_32bits.exe
FA-7F-C4-F1-FF-0A-DA-AF-41-90-E6-55-A7-94-62-29-0A-1A-80-9D BarcodeR11.exe
88-93-5F-13-D2-3B-60-16-E2-8E-09-1F-FC-08-0E-DD-30-13-C7-42 bsdkw30016eu.exe
33-C7-6A-B5-48-BE-BD-D7-F6-EA-45-62-73-F0-5A-E4-1E-9E-B3-68 CamStudio_Setup_v2.6b_r294_(build_24Oct2010).exe
6A-77-BB-40-F3-84-CD-BC-DB-52-0B-07-65-02-94-59-AD-D7-8F-CF ca_setup.exe
0A-58-F8-40-0A-1B-F3-E8-D1-F2-F7-6A-E2-93-02-DC-04-CC-03-4C ccsetup324_pro.exe
7D-15-E5-92-6C-95-48-B3-4C-EA-07-4C-15-8E-E5-30-1B-02-31-F1 ChromeSetup.exe
64-CC-CB-84-BF-05-E2-FA-AF-60-E1-FC-1C-38-E9-0E-73-8E-CE-E8 diptrace_en.exe