Serialcoder en Français Serialcoder in English
TEL : +33 (0)8 77 91 48 38

c# : How to hash a string to MD5

 

MD5 hash is a method to obtain a unique "signature" from a string. It is very usefull in order to store password, but be aware that there is no way to get back to the original string, starting from the hash.

I use it for creating unique filename for caching url crawling.

Here is a snipped of a method that give the MD5 hash from a string:

private string HashString(string Value)
{
        System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
        byte[] data = System.Text.Encoding.ASCII.GetBytes(Value);
        data = x.ComputeHash(data);
        string ret = "";
        for (int i=0; i < data.Length; i++)
                ret += data[i].ToString("x2").ToLower();
        return ret;
}

lundi 12 mai 2008 | Predicate<T>



Articles techniques technologie microsoft .Net :

Mise à jour du 13 Mai 2008 (Build 2382)

Les elements suivants ont été mis en place lors de cette mise à jour.

Nouvelles fonctionnalités :

  • CRM (Gestion de la relation client) , possibilité d'associer à chaque etape du workflow de vente des tickets de retour client ou de tache a accomplir, un article dedié...
En savoir plus

mardi 15 avril 2008 | ERP 360

Cher Entreprenaute, vous pouvez trouver ici votre passeport pour l'economie numerique

Latest releases

Keyword studio 1.1
Générez des nouveaux mots clés pour vos campagnes PPC et découvrez qui de vos concurrents les achetent.
keyword generator and suggestion tool download Download now
Visual Log Parser 1.0
GUI for the powerfull log parser.
download Visual Log Parser GUI Download now
Open Shopping Cart 1.0
Open Shopping Cart, composant asp.net pour la gestion d'un panier de commande
download open shopping cart for asp.net component Download now
.Net search engine
Search through .Net contents.
.net search engine Try now
.NET (dotnet) FAQ
A growing knowledge base about ASP.NET, Windows Forms and .NET 2.
ASP.NET FAQ Check it now
.netTiers support
and developpement

Smart Code Generator

Serialcoder participe activement au projet opensource Smart Code Generator

smartcodegenerator