Get MD5 Hash : MD5 « Security « C# / C Sharp






Get MD5 Hash

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;
using System.Configuration;


public static class Common
{

    public static string getMD5Hash(string input)
    {
        System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create();
        byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
        byte[] hash = md5.ComputeHash(inputBytes);
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        for (int i = 0; i < hash.Length; i++)
        {
            sb.Append(hash[i].ToString("X2"));
        }
        return sb.ToString();
    }

}

   
  








Related examples in the same category

1.MD5 encode
2.MD5 Encrypt
3.Create MD5 Hash
4.Create ASCII MD5 Hash
5.Encrypt MD5
6.MD5 Hash
7.MD5 Hash
8.Makes a MD5 hash from a string
9.Get MD5 Hash (2)
10.Computes the MD5 checksum for a single file.
11.Get MD5 for a string
12.Get and verify MD5 Hash
13.Md5 Hash (2)