Tutorials
Resources
Forum
Reviews
Communities
Interview
Jobs
Projects
Training
Your
Ad
Here
Silverlight Games
|
Mentor
|
Code Converter
|
Articles
|
Code Factory
|
Computer Jokes
|
Members
|
Peer Appraisal
|
IT Companies
|
Bookmarks
|
Polls
|
Revenue Sharing
|
Lobby
|
Gift Shop
|
Prizes & Awards
My Profile
Sign In
Register
AdSense Revenue
Active Members
Today
Pawan
(35)
Deepika Harida...
(32)
Nadheera V
(30)
Last 7 Days
Nikhil Gaur
(598)
Anil Kumar ...
(582)
Abhisek Panda
(456)
more...
Resources
»
Code Snippets
»
Encryption
»
Generating MD5 for a string
Posted Date: 16 May 2008
Resource Type:
Code Snippets
Category:
Encryption
Author:
Payal Jain
Member Level:
Gold
Rating:
Points
: 10
Introduction
Following Code snippet will help u to generate MD5 hash for a string or text value
Namespaces used
namespace System.Security.Cryptography is required to be included using:
using System.Security.Cryptography;
Classes used
Md5 and MD5CryptoServiceProvider ....to create md5 hash provider
main code
//this is the full code to generate md5
Byte[] generatedBytes,originalBytes;
MD5 md5 = new MD5CryptoServiceProvider();
//convert string data to array of bytes
originalBytes = ASCIIEncoding.Default.GetBytes(txtMD5.Text);
//compute hash on generated byte array
generatedBytes = md5.ComputeHash(originalBytes);
//display hash bytes as readable string as the hash code generated will contain dash(-)
// to remove that Replace function of Regex is used here....
lblGeneratedMD5.Text = Regex.Replace(BitConverter.ToString(generatedBytes), "-", "");
Responses
No responses found. Be the first to respond and make money from
revenue sharing program
.
Feedbacks
Popular Tags
What are tags ?
Search Tags
Sign In
to add tags.
(No tags found.)
Post Feedback
This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must
Sign In
to post a response.
Next Resource:
Encrypting Selected node in a XML file
Previous Resource:
Bit Wise Encryption & decryption
Return to Discussion Resource Index
Post New Resource
Category:
Encryption
Post resources and
earn money
!
Related Resources
Encrypting Selected node in a XML file
How to encript and decript a password
How to encrypt a string using c#
Password Encryption - the Simple Way
Salted-MD5 Encryption
Password Encryption & Decryption samples
dotNet Slackers
About Us
Contact Us
Privacy Policy
Terms Of Use