Documentation ¶
Overview ¶
Package passwd contains methods for working with passwords
Index ¶
Examples ¶
Constants ¶
View Source
const ( STRENGTH_WEAK = iota // Only lowercase English alphabet characters STRENGTH_MEDIUM // Lowercase and uppercase English alphabet characters, digits STRENGTH_STRONG // Lowercase and uppercase English alphabet characters, digits, special symbols )
Variables ¶
This section is empty.
Functions ¶
func GenPassword ¶
GenPassword generates random password
Example ¶
weakPassword := GenPassword(16, STRENGTH_WEAK) medPassword := GenPassword(16, STRENGTH_MEDIUM) strongPassword := GenPassword(16, STRENGTH_STRONG) fmt.Printf("Weak password: %s\n", weakPassword) fmt.Printf("Medium password: %s\n", medPassword) fmt.Printf("Strong password: %s\n", strongPassword)
Output:
func GetPasswordStrength ¶
GetPasswordStrength returns password strength
Example ¶
strength := GetPasswordStrength("secret1234%$") switch strength { case STRENGTH_STRONG: fmt.Println("Password is strong") case STRENGTH_MEDIUM: fmt.Println("Password is ok") case STRENGTH_WEAK: fmt.Println("Password is weak") }
Output: Password is ok
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.