randomPassword

Generates a random password.

This is limited to generating ASCII passwords. This is because including non-ASCII characters in generated passwords is more complex, more error-prone, more likely to trigger latent unicode bugs in other systems, and not particularly useful anyway.

Throws an Exception if passwordChars.length isn't at least 2.

USE THIS RESPONSIBLY! NEVER EMAIL THE PASSWORD! Emailing a generated password to a user is a highly insecure practice and should NEVER be done. However, there are other times when generating a password may be reasonable, so this is provided as a convenience.

More...
  1. Password randomPassword(size_t length = defaultPasswordLength, const(ubyte)[] passwordChars = defaultPasswordChars)
  2. Password randomPassword(ref Rand rand, size_t length = defaultPasswordLength, const(ubyte)[] passwordChars = defaultPasswordChars)
  3. void randomPassword(ref Sink sink, size_t length = defaultPasswordLength, const(ubyte)[] passwordChars = defaultPasswordChars)
  4. void randomPassword(ref Rand rand, ref Sink sink, size_t length = defaultPasswordLength, const(ubyte)[] passwordChars = defaultPasswordChars)
    void
    randomPassword
    (
    Rand = DefaultCryptoRand
    Sink
    )
    (
    ref Rand rand
    ,
    ref Sink sink
    ,,
    )
    if (
    isDAuthRandom!Rand &&
    isOutputRange!(Sink, ubyte)
    )

Detailed Description

Optional Params

Rand - Default value is 'DefaultCryptoRand'

length - Default value is 'defaultPasswordLength'

passwordChars - Default value is 'defaultPasswordChars'

Meta