The passwords
package provides functions for hashing and verifying passwords using the Argon2id and bcrypt algorithms. It allows switching between these algorithms using a global variable.
go get -u github.com/gouef/passwords
You can found documentation for Passwords, Bcrypt and Argon.
package main
import (
"fmt"
"github.com/gouef/passwords"
)
func main() {
passwords.Use(passwords.ARGON) // Use Argon2id
hash, err := passwords.Hash("mypassword")
if err != nil {
fmt.Println("Error hashing password:", err)
return
}
fmt.Println("Hash:", hash)
isValid := passwords.Verify("mypassword", hash)
fmt.Println("Verification:", isValid)
}
Read Contributing
Click above to join our community on Discord!