Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Return A MD5 Hexa Encoded String

DZone's Guide to

Return A MD5 Hexa Encoded String

·
Free Resource

public static string MD5_ComputeHexaHash (string text) {
	// Gets the MD5 hash for text
	MD5 md5 = new MD5CryptoServiceProvider();
	byte[] data = Encoding.Default.GetBytes(text);
	byte[] hash = md5.ComputeHash(data);
	// Transforms as hexa
	string hexaHash = "";
	foreach (byte b in hash) {
		hexaHash += String.Format("{0:x2}", b);
	}
	// Returns MD5 hexa hash
	return hexaHash;
}
Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}