Skip to content

🔑 Gopass is a cryptographically secure random password generator Go library.

License

Notifications You must be signed in to change notification settings

cloudingcity/gopass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gopass

Test Lint codecov Go Report Card

🔑 Gopass is a cryptographically secure random password generator Go library.

QuickStart

package main

import "github.com/cloudingcity/gopass"

func main() {
	gopass.GenerateString(20) // vJd3NRrCImrSQf3M1h3A
}

Install

go get -u github.com/cloudingcity/gopass

Examples

Generate string contains letters and numbers with the given length.

Letters and numbers is the default option.

gopass.GenerateString(20) // vJd3NRrCImrSQf3M1h3A

Generate with options.

gopass.With(gopass.Numbers(), gopass.UpperCase(), gopass.Symbols())
gopass.GenerateString(20) // ^34J)GV.AE,@KA?+~MPG

Generate []byte

gopass.Generate(20) // [90 55 81 120 104 70 114 105 101 54]

Customize characters.

gopass.With(gopass.String("123"), gopass.Bytes([]byte("ABC")))
gopass.GenerateString(10) // 31AABCBB22

Create your own gopass instance.

pass := gopass.New(gopass.Numbers(), gopass.UpperCase())
pass.GenerateString(20) // AMQPZJ5OUGW4WVI8GB3C

Benchmarks

$ GOMAXPROCS=4 go test -bench=Generate -benchmem -benchtime=3s
BenchmarkGenerate-4               146948             25280 ns/op            4808 B/op        301 allocs/op
BenchmarkGenerateString-4         167050             25397 ns/op            4920 B/op        302 allocs/op

About

🔑 Gopass is a cryptographically secure random password generator Go library.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published