Fix for pull request #146

This commit is contained in:
sta 2015-08-04 15:50:36 +09:00
parent 82f089730e
commit 586a6202a2
2 changed files with 3 additions and 4 deletions

View File

@ -115,6 +115,7 @@ namespace WebSocketSharp
#region Internal Fields
internal const int FragmentLength = 1016; // Max value is Int32.MaxValue - 14.
internal static readonly RandomNumberGenerator RandomNumber = new RNGCryptoServiceProvider ();
#endregion
@ -1627,8 +1628,7 @@ namespace WebSocketSharp
internal static string CreateBase64Key ()
{
var src = new byte[16];
var rand = new Random ();
rand.NextBytes (src);
RandomNumber.GetBytes (src);
return Convert.ToBase64String (src);
}

View File

@ -277,8 +277,7 @@ namespace WebSocketSharp
private static byte[] createMaskingKey ()
{
var key = new byte[4];
var rand = new Random ();
rand.NextBytes (key);
WebSocket.RandomNumber.GetBytes (key);
return key;
}