CryptographyGetRandomKey Method |
Creates a random key of random length.
Namespace: InnerDrive.CoreAssembly: InnerDrive.Core (in InnerDrive.Core.dll) Version: 5.0.8475.0
Syntax public static string GetRandomKey(
int minLength,
int maxLength
)
Parameters
- minLength Int32
- The length in bytes of the shortest key to return.
- maxLength Int32
- The length in bytes of the longest key to return.
Return Value
StringA
String containing a random key of the appropriate length.
Exceptions Remarks This method uses a cryptographically strong random number generation
algorithm. To create the highest likelihood that the returned key is unique,
no processing is done on the key once it's generated.
The key is not guaranteed to be unique, but it is extraordinarily unlikely
that two keys will be the same. The method uses two different methods to generate
random numbers: a weak method, to get the key length, and a strong method
to generate the actual key. This increases the likelihood that the key will
be unique.
See Also