Saved password security

This commit is contained in:
KZ
2015-08-07 20:09:13 +01:00
parent 1725550b21
commit 6d0aa05761
44 changed files with 340 additions and 62 deletions

View File

@@ -51,7 +51,6 @@ namespace Jackett.Utils
return sb.ToString();
}
public static string GetExceptionDetails(this Exception exception)
{
var properties = exception.GetType()
@@ -74,5 +73,21 @@ namespace Jackett.Utils
{
return string.Join("&", collection.AllKeys.Select(a => a + "=" + HttpUtility.UrlEncode(collection[a])));
}
public static string GenerateRandom(int length)
{
var chars = "abcdefghijklmnopqrstuvwxyz0123456789";
var randBytes = new byte[length];
using (var rngCsp = new RNGCryptoServiceProvider())
{
rngCsp.GetBytes(randBytes);
var key = "";
foreach (var b in randBytes)
{
key += chars[b % chars.Length];
}
return key;
}
}
}
}