Refine random string generate.

This commit is contained in:
noisyfox
2016-12-09 01:39:07 +11:00
parent 9e51b4a41b
commit 4b067346bf
2 changed files with 7 additions and 2 deletions
@@ -5,7 +5,7 @@ using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
using Shadowsocks.Encryption;
using Shadowsocks.Model;
using Shadowsocks.Properties;
using Shadowsocks.Util;
@@ -40,7 +40,7 @@ namespace Shadowsocks.Controller
if (config.secureLocalPac)
{
var rd = new byte[32];
new Random().NextBytes(rd);
RNG.GetBytes(rd);
PacSecret = $"&secret={Convert.ToBase64String(rd)}";
}
else
+5
View File
@@ -26,6 +26,11 @@ namespace Shadowsocks.Encryption
Init();
}
public static void GetBytes(byte[] buf)
{
_rng.GetBytes(buf);
}
public static void GetBytes(byte[] buf, int len)
{
try