C# 加密-MD5 和 SHA1

在 ASP.NET 中可以非常方便地执行 MD5 或 SHA1 加密。

只需要两步:

1,引用名命空间:

  using System.Web.Security;

2,执行加密方法:

FORM身份验证时

md5Text.Text = FormsAuthentication.HashPasswordForStoringInConfigFile(md5Text.Text, "MD5");
sha1Text.Text = FormsAuthentication.HashPasswordForStoringInConfigFile(sha1Text.Text, "SHA1");

posted on 2009-11-30 11:07  冬日阳光  阅读(286)  评论(0编辑  收藏  举报

导航