How to register a global hotkey for your application in C#

How to register a global hotkey for your application in C#

Register a hotkey for your application that can be triggered even if your form is minimized and does not have focus. More »

How to download a file in C# (progressbar and download speed)

How to download a file in C# (progressbar and download speed)

Learn how to download files in C# while displaying the percentage and the download speed. More »

UDP hole punching implementation in C#

UDP hole punching implementation in C#

Learn how to implement UDP hole punching so you can make your clients life a lot easier by not forcing them to open ports on their end. More »

 

How to hash a string with salt using a multi-algorithm method

It is considered a very bad idea to store user credentials in plain text, especially passwords. For that very reason it is always a good idea to hash passwords before you store them, ideally with a unique salt that you can store in another location. That way if for whatever reason your database is compromised your users passwords will not be in plain text and it will require a bit of work in order to find out what each password is, especially if the salt for each password is stored somewhere else.

The following method is a multi algorithm method, that means that with this single method you can use more than one algorithm to hash your data. The snippet below shows an example how to hash your data with a single method using seven different algorithms.

Our main method that will do all the work for us:

And here are some test cases:

Share on FacebookTweet about this on TwitterShare on Google+Share on StumbleUponShare on LinkedInShare on RedditPin on PinterestShare on TumblrDigg thisPrint this pageEmail this to someone

Leave a Reply

Your email address will not be published. Required fields are marked *