---
title: "Implementing Cryptography by using MD5 algorithm."  
description: "In last blog I had explained that how to implement cryptography by using SHA1 algorithm. In this article I will describe another method to implement c"  
author: "Anonymous User"  
published: 2011-02-15  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/120/implementing-cryptography-by-using-md5-algorithm  
category: "security in .net"  
tags: ["security in .net"]  
reading_time: 1 minute  

---

# Implementing Cryptography by using MD5 algorithm.

In last blog I had explained that how to implement cryptography by using SHA1 [algorithm](https://www.mindstick.com/blog/119/implementing-cryptography-in-c-sharp-dot-net-by-using-sha1-algorithm). In this [article](https://www.mindstick.com/articles/95867/are-you-looking-for-500-credit-score-mortgage-lenders-houston-continue-reading-this-article) I will [describe](https://www.mindstick.com/interview/12752/what-is-ddms-describe-some-of-its-capabilities) another [method](https://www.mindstick.com/forum/166/webservice-method) to implement [concept of Cryptography](https://www.mindstick.com/forum/158545/explain-the-concept-of-cryptography-and-its-role-in-securing-data-during-transmission-and-storage) in C#. Here I will use MD5 algorithm to [encrypt data](https://www.mindstick.com/blog/687/encrypt-and-decrypt-data-with-c-sharp) from user.

##### Following code demonstrate use of MD5 algorithm

```
public static void encryptMd5() {             string strText = "";             Console.Write("Enter Name of Text--->   ");             strText = Console.ReadLine();             MD5CryptoServiceProvider provider = new MD5CryptoServiceProvider();             byte[] encryptData = provider.ComputeHash(Encoding.Default.GetBytes(strText));             Console.WriteLine("Encrypted Value Is....");             foreach (byte tempData in encryptData)             {                 Console.Write(tempData.ToString("x"));             }             Console.WriteLine(); }
```

##### Output of the above code snippet is as follows

Enter Name of Text---> [MindStick](https://yourviews.mindstick.com/view/84668/how-mindstick-is-used-for-marketing-purposes)\
Encrypted [Value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages) Is....\
dcfff63dc26387bf19cea60d5de240

Enter Name of Text---> Washington\
Encrypted Value Is....\
6d69689d056a27bce65398abc70297a

---

Original Source: https://www.mindstick.com/blog/120/implementing-cryptography-by-using-md5-algorithm

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
