Skip to content

Commit 327e6c6

Browse files
committed
use same Randomizer instance
1 parent 6c3c06d commit 327e6c6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Renci.SshNet/Abstractions/CryptoAbstraction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Renci.SshNet.Abstractions
77
{
88
internal static class CryptoAbstraction
99
{
10-
private static readonly RandomNumberGenerator Randomizer = RandomNumberGenerator.Create();
10+
internal static readonly RandomNumberGenerator Randomizer = RandomNumberGenerator.Create();
1111

1212
internal static readonly SecureRandom SecureRandom = new SecureRandom(new CryptoApiRandomGenerator(Randomizer));
1313
}

src/Renci.SshNet/Abstractions/RandomNumberGeneratorExtensions.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
#nullable enable
2+
#if !NET
3+
using Renci.SshNet.Abstractions;
4+
#endif
5+
26
namespace System.Security.Cryptography
37
{
48
internal static class RandomNumberGeneratorExtensions
59
{
6-
#if !NET
7-
private static readonly RandomNumberGenerator Randomizer = RandomNumberGenerator.Create();
8-
#endif
9-
1010
extension(RandomNumberGenerator)
1111
{
1212
#if !NET
1313
public static byte[] GetBytes(int length)
1414
{
1515
var random = new byte[length];
16-
Randomizer.GetBytes(random);
16+
CryptoAbstraction.Randomizer.GetBytes(random);
1717
return random;
1818
}
1919
#endif

0 commit comments

Comments
 (0)