.NET Security

章哲彦
2023-12-01

using System;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;

namespace ASPNET.StarterKit.Commerce.Components
{
 /// <summary>
 /// Summary description for Security.
 /// </summary>
 public class Security
 {
  //*********************************************************************
  //
  // Security.Encrypt() Method
  //
  // The Encrypt method encrypts a clean string into a hashed string
  //
  //*********************************************************************
  public static string Encrypt(string cleanString)
  {
   Byte[] clearBytes = new UnicodeEncoding().GetBytes(cleanString);
   Byte[] hashedBytes = ((HashAlgorithm) CryptoConfig.CreateFromName("MD5")).ComputeHash(clearBytes);
   
   return BitConverter.ToString(hashedBytes);
  }
 }
}

转载于:https://www.cnblogs.com/ya0911/archive/2005/02/21/107128.html

 类似资料:

相关阅读

相关文章

相关问答