[email protected]      beta

How to convert string into MD5 hash?

Here in this article will explain how to convert a string value to md5 hash value, i.e. Using System.security.Cryptography we can convert a string into Md5 hash value, which is encryption.
MD5 is an acronym for Message-Digest 5– a fast and powerful method of increasing security to file transfers and request message transfers.
The way it works is the user enters an input string, and the md5 algorithm will generate a 32-character string in hexadecimal characters. The characters will always be hexadecimal, and the string will always be 32 characters in length.
Once a string is hashed into a md5 hash, it cannot be unhashed via any “un-md5” algorithm. The only way is to use an MD5 cracker tool, which queries an extensive database of strings and their associated md5 hashes.
Once your md5 hash code is generated, you can deliver it to the expected receiver, and they can use that hash to match against their result of performing a md5 hash on their own values. If the hashes match, then you can be confident that the data was sent correctly.

CODE to convert string into md5 hash value:

using System.Text;
using System.Security.Cryptography;
public static string ConvertStringtoMD5(string strword)
 MD5 md5 = MD5.Create();
 byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(strword);
 byte[] hash = md5.ComputeHash(inputBytes);
 StringBuilder sb = new StringBuilder();
 for (int i = 0; i < hash.Length; i++)
 return sb.ToString();

Satinder Singh

Hi all, am Founder and Author of Codepedia.info, also atypical polyglot programmer from Bombay, India. I have a passion to create, solve, and deploy software applications.
       ForEach ( minute in MyLife ) { myExperience++ ; }

Post Comment

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