What is a "32 byte long string"? A string consists of characters, not bytes. It looks like you have a string containing 32 characters, but that will occupy 64 bytes.
Have you really stored the string in a byte array? How? Have you encoded the string? Then you should decode the string using the same encoding.
Once you have the data as a string, you can split it up into 16 separate strings using the Substring method. Then use the Int32.Parse method with NumberStyles.AllowHexSpecifier to parse each two character string into a byte value.
Okay, having implemented your code I've got a saving of three seconds with 2755 hashes processed.
My code took 2 mins 33 secs to process, whereas yours took 2 minutes 30 - that's 18.3 hash conversions per second! This is a small sample file so I'm sure that in the real world application of this the savings will be very significant.
I'm new to C# multithreading and I read that to resolve deadlock it is best to use monitor with timeout.With this in mind I used the following code to see what happens to the deadlocking generated.
The result is the following exception
Unhandled Exception: System.Threading.SynchronizationLockException: Object synchronization method was called from an unsynchronized block of code.
Why this? What's wrong with my code or my approach?
which implies that Monitor.Exit can be called on a thread , for a resource only if that thread has already acquired lock for that resource.
you are calling Monitor.Exit (one out of try statements) on threads without assuring that a thread has already successfully acquired monitor on a specified resource. (i.e Monitor.TryEnter may not have been successfull). please Check the returned value from Monitor.TryEnter for both 'First' and 'Second' rountines.
Cheers to you. I'm now on the right track. Basically I load in the kernall32.dll and I can call the DeviceIoControl() method from there. P/Invoke is a way to make interop possible by loading .dlls from the past. Very nice. Thanks very much Ed.Poore
Why would you want to do that? Wouldn't it be better to set-up a streaming server or something like that, take a look at Windows Media Encoder[^]. Just set-up your server and connect to it from the client program.
I'm writing a program that needs to take a list of hostnames/usernames/passwords and change each machine's registry settings over the network. I've tried using OpenRemoteBaseKey, but that only allows for a hostname input. I have limited network programming experience and was wondering if there was an easy way I could connect to each of my nodes over the network to change the registries. I can elaborate if needed. Thanks in advance!