mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-10 17:25:51 +00:00
Added CryptoAbstraction.GenerateRandom(int length) method.
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user