mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Saved password security
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user