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;
}