Skip to content

Commit 86bf0b3

Browse files
committed
Merge pull request #315 from icylogic/hotfix/repeated_iv
no repeat random number generator by GangZhuo
2 parents b469949 + 72ea01d commit 86bf0b3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

shadowsocks-csharp/Encryption/IVEncryptor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ protected void bytesToKey(byte[] password, byte[] key)
8888
protected static void randBytes(byte[] buf, int length)
8989
{
9090
byte[] temp = new byte[length];
91-
new Random().NextBytes(temp);
91+
RNGCryptoServiceProvider rngServiceProvider = new RNGCryptoServiceProvider();
92+
rngServiceProvider.GetBytes(temp);
9293
temp.CopyTo(buf, 0);
9394
}
9495

0 commit comments

Comments
 (0)