modulepackage
1.4.0
Repository: https://github.com/moonrhythm/passwordtool.git
Documentation: pkg.go.dev
# README
passwordtool
Password hashing and comparing tool
Install
go get github.com/moonrhythm/passwordtool
Usage
hashed, err := passwordtool.Hash("superman")
if err != nil {
// ...
}
fmt.Println(hashed)
err = passwordtool.Compare(hashed, "superman")
if err == passwordtool.ErrMismatched {
// not equal
}
if err != nil {
// ...
}
Specific algorithm
hc := passwordtool.Bcrypt{Cost: 11}
hashed, err := hc.Hash("superman")
if err != nil {
// ...
}
err = hc.Compare(hashed, "superman")
if err == passwordtool.ErrMismatched {
// not equal
}
if err != nil {
// ...
}
// or
err = passwordtool.Compare(hashed, "superman")
if err == passwordtool.ErrMismatched {
// not equal
}
if err != nil {
// ...
}
License
MIT
# Variables
Errors.
Errors.
Hasher strategies.
Hasher strategies.
Hasher strategies.
# Structs
Argon2id strategy.
Bcrypt strategy.
BcryptHash strategy.
PBKDF2 strategy.
Scrypt strategy.