Added CryptoAbstraction.GenerateRandom(int length) method.

This commit is contained in:
Gert Driesen
2017-08-06 17:54:47 +02:00
parent f90131229a
commit 3e1dd2d345
@@ -9,6 +9,18 @@ namespace Renci.SshNet.Abstractions
private static readonly System.Security.Cryptography.RandomNumberGenerator Randomizer = CreateRandomNumberGenerator();
#endif
/// <summary>
/// Generates a <see cref="Byte"/> array of the specified length, and fills it with a
/// cryptographically strong random sequence of values.
/// </summary>
/// <param name="length">The length of the array generate.</param>
public static byte[] GenerateRandom(int length)
{
var random = new byte[length];
GenerateRandom(random);
return random;
}
/// <summary>
/// Fills an array of bytes with a cryptographically strong random sequence of values.
/// </summary>