Password generator, support export KeePass 1.x and 1Passworld format csv file.
AppDoc: http://godoc.org/github.com/chai2010/pwdgen
docker run --rm -it chai2010/pwdgen -h
go getgo get github.com/chai2010/pwdgen
$ pwdgen id0
$ pwdgen id0 id1 id2
$ pwdgen -salt=site0 id0
$ pwdgen -salt=site0 id0 id1 id2
$ pwdgen -encrypt-key=111 id0
$ pwdgen -encrypt-key=111 id0 id1 id2
$ pwdgen -encrypt-key=111 -salt=site0 id0 id1
$ pwdgen -encrypt-key=111 -salt=site0 id0 id1
$ pwdgen -encrypt-key=111 -salt=site0 id0 id1
$ # Generate config.ini template
$ pwdgen -gen-config=config.ini
# KeePass: See config.ini
# output: *.ini -> *.keepass1x.csv
pwdgen -keepass-config=config.ini
pwdgen -keepass-config=config.ini -encrypt-key=111
# 1password: See config.ini
# output: *.ini -> *.1password.csv
pwdgen -one-password-config=config.ini
pwdgen -one-password-config=config.ini -encrypt-key=111
$ pwdgen -version
$ pwdgen -help
$ pwdgen -h
package main
import (
"fmt"
pwdgen "github.com/chai2010/pwdgen/pwdgen"
)
func main() {
fmt.Println(pwdgen.PwdGen("id0", "site0", "111", "fuckcsdn"))
// Output: 2jNXfMGoXTSK9pFS
}
Default:
base58(sha512(md5hex(encryptKey+encryptSalt)+siteId+siteSalt))[0:16]
Other:
PasswordLength := 4~64, default is 16
PasswordType := number|alpha|ALPHA|base32|BASE32|base58, default is base58
Length := PasswordLength
Encoding := PasswordType
Encoding(sha512(md5hex(encryptKey+encryptSalt)+siteId+siteSalt))[0:Length]
alpha, ALPHA encoder:
func PwdGen(
siteId, flagSiteSalt,
flagEncryptKey, flagEncryptSalt string,
encType EncoderType, length int,
) (string, error) {
...
alphabet := "abcdefghijklmnopqrstuvwxyz"
if encType == EncoderType_AlphaUpper {
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
}
x := new(big.Int).SetBytes(shaSum) // shaSum is big-endian
y := big.NewInt(int64(len(alphabet)))
m := new(big.Int)
var buf [256]byte
var idx = len(buf)
for x.Sign() > 0 {
x, m = x.DivMod(x, y, m)
buf[idx-1] = byte(alphabet[int32(m.Int64())])
idx--
}
pwd := string(buf[idx:][0:length])
return pwd, nil
...
}
Command Line

KeePass 2.x

1Passworld 4

Content type
Image
Digest
Size
2.8 MB
Last updated
almost 9 years ago
docker pull chai2010/pwdgen