zoukankan      html  css  js  c++  java
  • MD5加密的两种方式笔记。

    第一种方式是使用:
    System.Web.Security空间下的相应类和方法加密,示例:
    public string GetMD5(string s,int len)
    {
       
    return FormsAuthentication.HashPasswordForStoringInConfigFile(s,"MD5").Substring(0,len).ToLower();
    }
    第二种方式:
    public string GetMD5(string s,int len)
    {
      System.Security.Cryptography.MD5 md5
    =System.Security.Cryptography.MD5.Create();
      
    byte[] bytes=System.Text.Encoding.UTF8.GetBytes(s);
    bytes
    =md5.ComputeHash(bytes);
    return System.BitConverter.ToString(buffer).Replace("-""").Substring(0,len).ToLower();
    }
  • 相关阅读:
    Scoket简介
    AOP
    Windows服务
    Nginx 教程 (1):基本概念
    异步编程
    并发编程
    常用排序
    序列化
    MSBuild/Projectjson
    不汇报是职场发展的绊脚石
  • 原文地址:https://www.cnblogs.com/McJeremy/p/1212600.html
Copyright © 2011-2022 走看看