Browse Source

Merge pull request #315 from icylogic/hotfix/repeated_iv

no repeat random number generator by GangZhuo
tags/2.5.7
icylogic 9 years ago
parent
commit
86bf0b3b2c
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      shadowsocks-csharp/Encryption/IVEncryptor.cs

+ 2
- 1
shadowsocks-csharp/Encryption/IVEncryptor.cs View File

@@ -88,7 +88,8 @@ namespace Shadowsocks.Encryption
protected static void randBytes(byte[] buf, int length)
{
byte[] temp = new byte[length];
new Random().NextBytes(temp);
RNGCryptoServiceProvider rngServiceProvider = new RNGCryptoServiceProvider();
rngServiceProvider.GetBytes(temp);
temp.CopyTo(buf, 0);
}


Loading…
Cancel
Save