zoukankan      html  css  js  c++  java
  • string path;

      public static string Encrypt(UserPasswordFormat format, string cleanString, string salt)
      {
       Byte[] clearBytes;
       Byte[] hashedBytes;
       Encoding encoding = Encoding.GetEncoding("unicode");
       clearBytes = encoding.GetBytes(salt.ToLower().Trim() + cleanString.Trim());

       hashedBytes = ((HashAlgorithm) CryptoConfig.CreateFromName("MD5")).ComputeHash(clearBytes);

         return BitConverter.ToString(hashedBytes);
         ;                     
       
      }
      public static Common GetConfig()
      {
       Common config = cache.Get(CacheKey) as Common;
       if(config == null)
       {
        string path;
        if(HttpContext.Current != null)
         path = HttpContext.Current.Server.MapPath("~/Forums.config");
        else
         path = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "Forums.config";

        XmlDocument doc = new XmlDocument();
        doc.Load(path);
        config = new Common(doc);
        cache.Insert(CacheKey,config,new CacheDependency(path),DateTime.MaxValue,TimeSpan.Zero,CacheItemPriority.AboveNormal,null);

        //cache.ReSetFactor(config.CacheFactor);
       }
       return config;
               
      }

  • 相关阅读:
    继续OI
    [WARNING]考前必读?!
    近些日的总结吧
    续上文
    又是一年NOIP然鹅我考的是高数(虽然我没打并且内容与NOIP无关)(手动滑稽)
    轮船问题(DP基础)
    NOIP2016报零记
    字符数组
    HA-0302 退役
    各种模板(part 2)
  • 原文地址:https://www.cnblogs.com/sujingnan/p/963770.html
Copyright © 2011-2022 走看看