Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 1 month 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 (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-04T17:08:04.000Z (almost 3 years ago)
- Last Synced: 2024-10-12T03:11:54.788Z (2 months 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
![Version](https://img.shields.io/github/v/tag/hedhyw/go-psw)
[![Build Status](https://app.travis-ci.com/hedhyw/go-psw.svg?branch=main)](https://app.travis-ci.com/github/hedhyw/go-psw)
[![Go Report Card](https://goreportcard.com/badge/github.com/hedhyw/go-psw)](https://goreportcard.com/report/github.com/hedhyw/go-psw)
[![Coverage Status](https://coveralls.io/repos/github/hedhyw/go-psw/badge.svg?branch=main)](https://coveralls.io/github/hedhyw/go-psw?branch=main)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/hedhyw/go-psw)](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 mainimport (
"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).