Skip to content

Commit 3e1dd2d

Browse files
committed
Added CryptoAbstraction.GenerateRandom(int length) method.
1 parent f901312 commit 3e1dd2d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Renci.SshNet/Abstractions/CryptoAbstraction.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ internal static class CryptoAbstraction
99
private static readonly System.Security.Cryptography.RandomNumberGenerator Randomizer = CreateRandomNumberGenerator();
1010
#endif
1111

12+
/// <summary>
13+
/// Generates a <see cref="Byte"/> array of the specified length, and fills it with a
14+
/// cryptographically strong random sequence of values.
15+
/// </summary>
16+
/// <param name="length">The length of the array generate.</param>
17+
public static byte[] GenerateRandom(int length)
18+
{
19+
var random = new byte[length];
20+
GenerateRandom(random);
21+
return random;
22+
}
23+
1224
/// <summary>
1325
/// Fills an array of bytes with a cryptographically strong random sequence of values.
1426
/// </summary>

0 commit comments

Comments
 (0)