https://github.com/hedhyw/go-psw
A tiny secure-random password generator
https://github.com/hedhyw/go-psw
bdd-tests cli crypto generator go golang password rand random random-generation random-number-generators secure
Last synced: 2 months ago
JSON representation
A tiny secure-random password generator
- Host: GitHub
- URL: https://github.com/hedhyw/go-psw
- Owner: hedhyw
- License: mit
- Created: 2022-02-04T16:47:40.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-04T17:08:04.000Z (over 4 years ago)
- Last Synced: 2024-12-31T17:25:48.083Z (over 1 year ago)
- Topics: bdd-tests, cli, crypto, generator, go, golang, password, rand, random, random-generation, random-number-generators, secure
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: License
Awesome Lists containing this project
README
# go-psw

[](https://app.travis-ci.com/github/hedhyw/go-psw)
[](https://goreportcard.com/report/github.com/hedhyw/go-psw)
[](https://coveralls.io/github/hedhyw/go-psw?branch=main)
[](https://pkg.go.dev/github.com/hedhyw/go-psw?tab=doc)
**A tiny golang tool for generating a crypto-random password in a terminal.**

## Installation
```sh
go install github.com/hedhyw/go-psw/cmd/psw@latest
```
## Usage
```sh
psw [LENGTH] [CHARS_PATTERN]
# Just generate a secure-random password:
psw
# Generate a password of length 10:
psw 10
# Generate only with given pattern (next example will print [a-zA-Z]):
psw 10 aA
# Special case (next example will print only [ёàは]):
psw 10 ёàは
```
## Using as a library
```go
package main
import (
"fmt"
"log"
"github.com/hedhyw/go-psw/pkg/v1/consts"
"github.com/hedhyw/go-psw/pkg/v1/generator"
)
func main() {
g := generator.NewCryptoRandGenerator()
chars, err := g.GeneratePassword(
consts.Digits+consts.LowerLetters, // Chars to use.
10, // Password length.
)
if err != nil {
log.Fatal(err)
}
fmt.Println(chars)
}
```
## License
See [License](License).