---
title: "ASP.NET MD5加密"
author: "unixtux"
date: "2012-07-26T10:30:11Z"
tags: ["C#"]
categories: ["编程语言"]
slug: "asp-net-md5"
draft: false
lastmod: "2012-07-19T14:54:59Z"
id: 1600656
url: "https://unixtux.iteye.com/blog/1600656"
---

\[code="c#"]using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; using System.Web; using System.Security.Cryptography; ×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××× ×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××× /// /// 用md5加密 /// /// 输入的数据 /// public static string MD5(string Sourcein) { MD5CryptoServiceProvider MD5CSP = new MD5CryptoServiceProvider(); byte\[] MD5Source = System.Text.Encoding.UTF8.GetBytes(Sourcein); byte\[] MD5Out = MD5CSP.ComputeHash(MD5Source); return Convert.ToBase64String(MD5Out); } \[/code]