Refine RNG usage
- Create instance once, bind it to ShadowsocksController Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
This commit is contained in:
@@ -68,6 +68,7 @@ namespace test
|
||||
|
||||
private void RunEncryptionRound(IEncryptor encryptor, IEncryptor decryptor)
|
||||
{
|
||||
RNG.Reload();
|
||||
byte[] plain = new byte[16384];
|
||||
byte[] cipher = new byte[plain.Length + 16 + IVEncryptor.ONETIMEAUTH_BYTES + IVEncryptor.AUTH_BYTES];
|
||||
byte[] plain2 = new byte[plain.Length + 16];
|
||||
@@ -117,6 +118,7 @@ namespace test
|
||||
{
|
||||
t.Join();
|
||||
}
|
||||
RNG.Close();
|
||||
Assert.IsFalse(encryptionFailed);
|
||||
}
|
||||
|
||||
@@ -156,6 +158,7 @@ namespace test
|
||||
{
|
||||
t.Join();
|
||||
}
|
||||
RNG.Close();
|
||||
Assert.IsFalse(encryptionFailed);
|
||||
}
|
||||
|
||||
@@ -196,6 +199,7 @@ namespace test
|
||||
{
|
||||
t.Join();
|
||||
}
|
||||
RNG.Close();
|
||||
Assert.IsFalse(encryptionFailed);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user