Most people I’ve seen online compute a simple hash of password + salt for persistence and authentication. This is the accepted standard in a straight-forward solution: byte[] Hash(string password) { byte[] pass = System.Text.Encoding.UTF8.GetBytes(password); //Create the salt to use byte[] salt = new byte[32]; new RNGCryptoServiceProvider().GetBytes(salt); //Create the hash of password and salt HashAlgorithm hashAlgo [...]

 

So recently I’ve been working heavily with some of the cryptography stuff in .Net and adding a large amount of it to my open source library. One of the many things I needed to perform was simply encrypting and decrypting a piece of data with a password. It seems everyone out there is using Rfc2898DeriveBytes [...]

 

Changes in this version: Library.Crypto namespace was added with a fairly complete cryptography API (at least what I needed) including: Added Library.Crypto.WhirlpoolManaged a managed implementation of the whirlpool hash function. Added Library.Crypto.Password to wrap up the complexities of using a password for authentication and/or encryption. Library.IO namespace was added to include several new stream derivations [...]

 

As promised in the previous post “How to implement a generic Shallow-Clone for an object in C#” this will demonstrate deep-cloning objects that don’t explicitly support the behavior. Before I continue I will again state that I don’t recommend this approach. It will be many times slower than a properly implemented Clone() and can cause [...]

 

Changes in this version: CSBuild initial release – a command-line compilation utility that drives MSBuild to compile designated project files. Added Library.Cloning namespace to support deep-object cloning of any object using either memberwize or serializable copy. Added Library.Collections.ReadOnlyList to provide a read-only collection interface and implementation. Added Library.Collections.OrdinalList to provide a collection of integers stored [...]

 

My last post reguarding “Deadlocks and other issues with Invoke / BeginInvoke” was something of a rant on the subject of WinForms and multi-threading. I thought I’d post on the useage of the solution that was presented originally on the stackoverflow article. The following defines the interface portion of the class: public class EventHandlerForControl<TEventArgs> where [...]

 

Let’s face it, using the System.Diagnostics.Process to run a process and capture the output is not as easy as it should be. People often get it wrong without realizing it. Adding to the complexities can be reading both the standard output as well as the standard error stream. To put this to bed once and [...]

 

For many years (more than I care to remember) I have continually written code to provide command-line behavior over and over again. On occasion I would get fancy in one project or another and build something sorta-generic; however, every time it came to creating the next command-line tool I started from scratch. Finally I said [...]

 

A brief how-to on providing user settings in your application. First, if you want to provide defaults, you want to add the following to the application’s configuration: Notice there are two levels of the <add> tag, one is ‘global’ settings, the other is segregated off in a named section. Reading this information is along the [...]