asp.net中md5加密实现代码

作者:袖梨 2022-06-25
 代码如下 复制代码

public class FormatStr
{
#region MD5加密
///


/// MD5加密操作
///

/// 加密的字符串
///
public static string MD5(string str) { 
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5");
}
#endregion 

#region 去除HTML标记
///


/// 去除HTML标记
///

/// 包括HTML的源码
/// 已经去除后的文字
public static string NoHTML(string Htmlstring)
{
//删除脚本
Htmlstring = Regex.Replace(Htmlstring, @"]*?>.*?", "", RegexOptions.IgnoreCase);
//删除HTML
Htmlstring = Regex.Replace(Htmlstring, @"<(.[^>]*)>", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"([rn])[s]+", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"-->", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"