Skip to content

gouef/passwords

Passwords

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.

Static Badge

GoDoc GitHub stars Go Report Card codecov

Versions

Stable Version GitHub Release GitHub Release

Installation

 go get -u github.com/gouef/passwords

Documentation

You can found documentation for Passwords, Bcrypt and Argon.

Simplify usage

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)
}

Contributing

Read Contributing

Contributors

JanGalek actions-user

Join our Discord Community! 🎉

Discord

Click above to join our community on Discord!