Hi group.
Any ideas how I could speed up/streamline the below code? Particuarly,
is there a way to use a progress bar for when it calculates the MD5?
Currently it just looks like it is hung for large files.
Private Function MakeMD5(srcFile Name as String)
Dim DBfs As FileStream
Dim byt() As Byte
If (New FileInfo(srcFil eName).Exists) Then
Try
Dim md5 As New MD5CryptoServic eProvider
DBfs = File.Open(srcFi leName, FileMode.Open,
_FileAccess.Rea d, FileShare.ReadW rite)
byt = md5.ComputeHash (DBfs)
Return (BitConverter.T oString(byt))
Catch ex As Exception
Msgbox(ex.Messa ge)
Finally '
If (Not IsNothing(DBfs) ) Then DBfs.Close()
End Try
End If
End Function
--
Daniel
MCSE, MCP+I, MCP in Windows 2000/NT
--------------------------------------
remove the 2nd madrid from my mail address to contact me. 4 1447
Since System.Security .Cryptography.M D5.ComputeHash( ) is doing all the work,
I don't think there's much more you can do.
However, System.Security .Cryptography.M D5.ComputeHash( ) also accepts a Byte
array. I doubt you would see any sort of performance increase by loading
the file into a byte array yourself and then passing that to ComputeHash(),
but it's something to try.
If you want to have a progress bar increment with this, then you'll have to
write a function that will compute the hash yourself. ComputeHash() doesn't
appear to raise any trappable progress events.
- Don
"Daniel" <da****@madridm adridsoleado.co m> wrote in message
news:e$******** *****@TK2MSFTNG P15.phx.gbl... Hi group.
Any ideas how I could speed up/streamline the below code? Particuarly, is there a way to use a progress bar for when it calculates the MD5? Currently it just looks like it is hung for large files.
Private Function MakeMD5(srcFile Name as String)
Dim DBfs As FileStream Dim byt() As Byte
If (New FileInfo(srcFil eName).Exists) Then
Try Dim md5 As New MD5CryptoServic eProvider
DBfs = File.Open(srcFi leName, FileMode.Open, _FileAccess.Rea d, FileShare.ReadW rite)
byt = md5.ComputeHash (DBfs)
Return (BitConverter.T oString(byt))
Catch ex As Exception
Msgbox(ex.Messa ge)
Finally '
If (Not IsNothing(DBfs) ) Then DBfs.Close()
End Try
End If
End Function
--
Daniel MCSE, MCP+I, MCP in Windows 2000/NT
-------------------------------------- remove the 2nd madrid from my mail address to contact me.
Don wrote: Since System.Security .Cryptography.M D5.ComputeHash( ) is doing all the work, I don't think there's much more you can do.
However, System.Security .Cryptography.M D5.ComputeHash( ) also accepts a Byte array. I doubt you would see any sort of performance increase by loading the file into a byte array yourself and then passing that to ComputeHash(), but it's something to try.
If you want to have a progress bar increment with this, then you'll have to write a function that will compute the hash yourself. ComputeHash() doesn't appear to raise any trappable progress events.
- Don "Daniel" <da****@madridm adridsoleado.co m> wrote in message news:e$******** *****@TK2MSFTNG P15.phx.gbl...
Hi group.
Any ideas how I could speed up/streamline the below code? Particuarly, is there a way to use a progress bar for when it calculates the MD5? Currently it just looks like it is hung for large files.
Private Function MakeMD5(srcFile Name as String)
Dim DBfs As FileStream Dim byt() As Byte
If (New FileInfo(srcFil eName).Exists) Then
Try Dim md5 As New MD5CryptoServic eProvider
DBfs = File.Open(srcFi leName, FileMode.Open, _FileAccess.R ead, FileShare.ReadW rite)
byt = md5.ComputeHash (DBfs)
Return (BitConverter.T oString(byt))
Catch ex As Exception
Msgbox(ex.Messa ge)
Finally '
If (Not IsNothing(DBfs) ) Then DBfs.Close()
End Try
End If
End Function
--
Daniel MCSE, MCP+I, MCP in Windows 2000/NT
-------------------------------------- remove the 2nd madrid from my mail address to contact me.
I thought about doing it via a stream as this will at least allow me to
draw something on the screen. Any ideas how to do this?
Thanks.
--
Daniel
MCSE, MCP+I, MCP in Windows 2000/NT
--------------------------------------
remove the 2nd madrid from my mail address to contact me.
"Daniel" <da****@madridm adridsoleado.co m> wrote in message
news:uC******** ******@TK2MSFTN GP10.phx.gbl... I thought about doing it via a stream as this will at least allow me to draw something on the screen. Any ideas how to do this?
I've never done it, but I did a quick search and found an MD5 project here: http://www.frez.co.uk/freecode.htm#md5
It's written in VB, but it should be easy to convert to VB.NET
- Don This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: andrewpalumbo |
last post by:
I'm trying to write some code which will split up a vector into two
halves and run a method on the objects in the vector using two seperate
threads. I was hoping to see a near linear speedup on an SMP machine,
but I'm finding that the code below takes almost exactly the same
amount of time as when I iterate through the vector, and don't use any
threads at all (using only one processor). I'm running this on a Dual
Athlon machine under...
|
by: Mark Dickinson |
last post by:
I have a simple 192-line Python script that begins with the line:
dummy0 = 47
The script runs in less than 2.5 seconds. The variable dummy0 is never
referenced again, directly or indirectly, by the rest of the script.
Here's the surprise: if I remove or comment out this first line, the
script takes more than 15 seconds to run. So it appears that adding a
redundant line produces a spectacular six-fold increase in speed!
|
by: TM |
last post by:
I have a small application that displays records from an access mdb into two
datagrids and am looking to see if it is possible to speedup the loadtime
somehow.
In my formload I am filling my dataset and binding it to the datagrids. Is
there a better place to get my grids loaded and speed up the program
loadtime ?
Thanks
--
|
by: Lars Schouw |
last post by:
All,
Does anyone know how much performance speedup I can expect by using 64
bit C++ / Windows XP 64 bit over the 32 bit versions?
Did anyone test this under Visual Studio 2005 or Intel C++ 8.1/9.0 ?
My application domain is montecarlo simulations but any test would be
great.
|
by: Galen Somerville |
last post by:
My VB2005 app gets real time Heart sounds and an ECG from a USB device. I'm
looking for a way to speed up the drawing of the traces on the screen.
In the following code the routine GetSounds recieves the USB data for six
consequtive horizontal pixels (or 6 sound/ECG samples). The routine FixChns
handles the scaling of the data and puts it into the PlotAry for
presentation.
The variable RptCnt then handles the placement for the 6 sets...
| |
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |