Browse Source

Refine random generator handling

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
tags/3.3.4
Syrone Wong 8 years ago
parent
commit
ce26bc15a9
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      shadowsocks-csharp/Encryption/IVEncryptor.cs

+ 4
- 4
shadowsocks-csharp/Encryption/IVEncryptor.cs View File

@@ -237,10 +237,10 @@ namespace Shadowsocks.Encryption
protected static void randBytes(byte[] buf, int length)
{
byte[] temp = new byte[length];
RNGCryptoServiceProvider rngServiceProvider = new RNGCryptoServiceProvider();
rngServiceProvider.GetBytes(temp);
temp.CopyTo(buf, 0);
using (RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider())
{
rng.GetBytes(buf, 0, length);
}
}
public override void Encrypt(byte[] buf, int length, byte[] outbuf, out int outlength)


Loading…
Cancel
Save