《C#中使用加密方式范例(sha1加密与md5加密)》
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace asp.net中的字符加密
{
 /// <summary>
 /// WebForm1 的摘要说明。
 /// </summary>
 public class WebForm1 : System.Web.UI.Page
 {
  private void Page_Load(object sender, System.EventArgs e)
  {
   // 在此处放置用户代码以初始化页面
   string s1="My name is wangjie";
   Response.Write("字符串My name is wangjie,经过sha1加密后为:<br>");
   string s2=System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(s1,"sha1");
   Response.Write(s2);
   Response.Write("<br>");
   string s3="i love c#";
   Response.Write("i love c#,经过md5加密后为:<br>");
            string s4=System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(s3,"md5");
   Response.Write(s4);
  }
  #region Web 窗体设计器生成的代码
  override protected void OnInit(EventArgs e)
  {
   //
   // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
   //
   InitializeComponent();
   base.OnInit(e);
  }
  
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {    
   this.Load += new System.EventHandler(this.Page_Load);
  }
  #endregion
 }
}

http://zdrjwlb.bulo. QQ群:1659819



 
											





 
	    

 
	


