Hash Password : Hash « Security « C# / C Sharp






Hash Password

 
        
// Copyright (c) 2010
// by http://openlightgroup.net/

using System;
using System.Data;
using System.Linq;
using System.Web;
using System.Xml.Linq;
using System.Net.Mail;
using System.Text;
using System.Collections.Generic;
using System.IO;
using System.Web.Security;

namespace SilverlightDebateForum
{
    public class Utility
    {

        #region HashPassword
        public static string HashPassword(int UserID, string Password)
        {
            // Note this password is 'salted' with the username when it is passed
            // to this method, so a basic dictionary attack would not work

            string HashedPassword = "";

            string UserPasswordAttempt = String.Format("{0}{1}", UserID.ToString(), Password);

            HashedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(UserPasswordAttempt,
                System.Web.Configuration.FormsAuthPasswordFormat.MD5.ToString());

            return HashedPassword;
        }
        #endregion
    }
}

   
  








Related examples in the same category

1.Verify Hex Hash, Base64 Hash, Byte Hash
2.Generic Hash
3.Get Public Key Hash with HttpClientCertificate
4.Get Public Key Hash with SHA256
5.Get Public Key Hash for a string
6.Hash As Password
7.Generate Hash
8.Get Hash for password
9.Generates a hash code of the input string
10.Hash Data
11.Get SHA256 Hash
12.Create Password Hash