Hidistro.Core/LicenseHelper.cs

(完整代码) 1KB

namespace Hidistro.Core
{
    using System;
    using System.Configuration;
    using System.IO;
    using System.Web;
    using System.Web.Caching;
    using System.Web.Security;

    public static class LicenseHelper
    {
        private const string PublicKeyCache = "FileCache-Publickey";

        public static string GetPublicKey()
        {
            string str = HiCache.Get("FileCache-Publickey") as string;
            if (string.IsNullOrEmpty(str))
            {
                string path = null;
                HttpContext current = HttpContext.Current;
                if (current != null)
                {
                    path = current.Request.MapPath("~/config/publickey.xml");
                }
                else
                {
                    path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"config\publickey.xml");
                }
                str = File.ReadAllText(path);
                HiCache.Max("FileCache-Publickey", str, new CacheDependency(path));
            }
            return str;
        }

        public static string GetSiteHash()
        {
            byte[] inArray = Convert.FromBase64String(ConfigurationManager.AppSettings["Key"]);
            string password = Convert.ToBase64String(inArray);
            Array.Clear(inArray, 0, inArray.Length);
            return FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。