This Go package provides functionalities to generate and validate passwords with varying levels of complexity. It includes a password generator that creates passwords of different strengths and a validator to assess the strength of a given password.
-
Password Generation:
- Low complexity passwords (8 characters, only lowercase letters and numbers)
- Medium complexity passwords (12 characters, includes uppercase letters and numbers)
- High complexity passwords (16 characters, includes uppercase letters, symbols, and numbers)
-
Password Validation:
- Evaluates password strength based on length and character types
- Scores passwords based on their complexity
To use this package in your Go project, follow these steps:
-
Install the package:
go get github.com/EstebanHorn/Password
-
Import the package in your Go code:
import "github.com/EstebanHorn/Password/generator" import "github.com/EstebanHorn/Password/validate"
Use the functions provided to generate passwords of different complexities:
-
Generate a low complexity password:
passwordLow := generator.GeneratePasswordLow() fmt.Println("Low complexity password:", passwordLow)
-
Generate a medium complexity password:
passwordMedium := generator.GeneratePasswordMedium() fmt.Println("Medium complexity password:", passwordMedium)
-
Generate a high complexity password:
passwordHard := generator.GeneratePasswordHard() fmt.Println("High complexity password:", passwordHard)
Use the validatePassword
function to assess the strength of a password:
password := "YourPassword123!"
score := validate.ValidatePassword(password)
fmt.Printf("Password strength score: %d\n", score)
Generates a low complexity password (8 characters, lowercase letters and numbers).
Generates a medium complexity password (12 characters, includes uppercase letters and numbers).
Generates a high complexity password (16 characters, includes uppercase letters, symbols, and numbers).
Evaluates the strength of a given password and returns a score based on its length and character types.
Contributions to this project are welcome! If you have suggestions or improvements, please submit a pull request or open an issue.
- Fork the repository
- Create a new branch for your feature or fix
- Commit your changes
- Push to the branch
- Create a pull request