A simple Go-based password generator that can be used as both a CLI tool and a reusable package.
- Generates secure random passwords.
- Ensures at least one lowercase, uppercase, digit, and special character.
- Supports password lengths between 12 and 20 characters.
- Can be used as a command-line tool or imported as a Go package.
Clone the repository:
git clone https://github.com/72kb/RandomPasswordGenerator.git
cd RandomPasswordGenerator
Build the executable:
go build -o passwordgen
Run the CLI with a specified password length:
./passwordgen -length=16
To save the password to a file:
./passwordgen -length=18 mypassword.txt
Fetch the package using go get
:
go get github.com/72kb/RandomPasswordGenerator/randomizer
Use it in your Go project:
package main
import (
"fmt"
"github.com/72kb/RandomPasswordGenerator/randomizer"
)
func main() {
password := randomizer.GeneratePassword(16)
fmt.Println("Generated Password:", password)
}
RandomPasswordGenerator/
│── randomizer/ # Go package folder
│ ├── randomizer.go # Contains password generation logic
│── main.go # CLI tool
│── go.mod # Go module file
│── README.md # Documentation
This project is open-source under the MIT License.