zoukankan      html  css  js  c++  java
  • System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(string, string)已过时的解决办法

    FormsAuthentication.HashPasswordForStoringInConfigFile 方法是一个在.NET 4.5中已经废弃不用的API,参见:

    https://msdn.microsoft.com/zh-cn/library/system.web.security.formsauthentication.hashpasswordforstoringinconfigfile(v=vs.110).aspx

    This is a solution for SH1 variant.

         public static string GetSwcSH1(string value)
         {
            SHA1 algorithm = SHA1.Create();
            byte[] data = algorithm.ComputeHash(Encoding.UTF8.GetBytes(value));
            string sh1 = "";
            for (int i = 0; i < data.Length; i++)
            {
                sh1 += data[i].ToString("x2").ToUpperInvariant();
            }
            return sh1;
         }

    For MD5 you only change algorithm to:

    MD5 algorithm = MD5.Create();

    参考:http://stackoverflow.com/questions/13527277/drop-in-replacement-for-formsauthentication-hashpasswordforstoringinconfigfile

  • 相关阅读:
    上传项目到githug
    架构漫谈阅读笔记01
    连接清华镜像
    Java-Spark
    推荐系统
    数据湖技术
    如何做好架构划分
    构建之法阅读笔记 02
    构建之法阅读笔记01
    Tensorflow安装
  • 原文地址:https://www.cnblogs.com/drsniper/p/4444306.html
Copyright © 2011-2022 走看看