passwords

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2025 License: BSD-3-Clause Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README ¶

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!

Documentation ¶

Index ¶

Constants ¶

This section is empty.

Variables ¶

This section is empty.

Functions ¶

func Default ¶

func Default()

func Hash ¶

func Hash(password string) (string, error)

func Use ¶

func Use(algo AlgoType)

func Verify ¶

func Verify(password, hash string) bool

Types ¶

type AlgoType ¶

type AlgoType string
var (
	BCRYPT AlgoType = "Bcrypt"
	ARGON  AlgoType = "Argon"
)
var Algo AlgoType = ARGON

Directories ¶

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL