Documentation
¶
Index ¶
Constants ¶
const ( // PasswordChars contains alphanumeric chars (0-9, A-Z, a-z), plus "-=+!@#$%^&*." PasswordChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-=+!@#$%^&*." // AlphaNumChars contains alphanumeric chars (0-9, A-Z, a-z) AlphaNumChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" )
Variables ¶
This section is empty.
Functions ¶
func GenerateRandomPassword ¶
GenerateRandomPassword generates a random password with the given length. The password will contain chars picked from the `PasswordChars` constant. If an error happens, the string will be empty and the error will be non-nil.
This is equivalent to `GenerateRandomString(PasswordChars, length)`
func GenerateRandomString ¶
GenerateRandomString generates a random string with the given length based on the chars provided. You can use `PasswordChars` or `AlphaNumChars` constants, or even any other string.
Chars from the provided string will be picked uniformly. The provided constants have unique chars, which means that all the chars will have the same probability of being picked. You can use your own strings to change that probability. For example, using "AAAB" you'll have a 75% of probability of getting "A" and 25% of "B"
Types ¶
This section is empty.