Refine RNG usage

- Create instance once, bind it to ShadowsocksController

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
This commit is contained in:
Syrone Wong
2016-11-09 10:28:50 +08:00
parent c908caa584
commit 8fcb66b6ff
5 changed files with 52 additions and 6 deletions
+4
View File
@@ -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);
}