Click or drag to resize

CryptographyGetRandomPassword Method

Creates a random password of a specified length. The password will be usable with Microsoft Windows security.

Namespace: InnerDrive.Core
Assembly: InnerDrive.Core (in InnerDrive.Core.dll) Version: 5.0.8475.0
Syntax
C#
public static string GetRandomPassword(
	int passwordLength
)

Parameters

passwordLength  Int32
The length, in characters, of the password to return.

Return Value

String
A String containing the password.
Exceptions
ExceptionCondition
ArgumentExceptionThrown if passwordLength is greater than MaxKeyLength.
Remarks
This method does not use a cryptographically strong random number generation algorithm. Also, it returns printable ASCII characters only between 0x21 and 0x7E, excluding 0x22 ("), 0x27 ('), 0x2C (,), 0x2E (.), and 0x60 (`). As a result, the password cannot be guaranteed unique or cryptographically strong, but for practical purposes it will be close enough.
See Also