password

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(pwd string, hash string) bool

Compare reports whether a plain text matches with hash.

For compatibility purposes, it can compare using both SHA256 and bcrypt algorithms. Hashes starting with "$" are assumed to be a bcrypt hash; otherwise, they are treated as SHA256 hashes.

func Hash

func Hash(pwd string) (string, error)

Hash takes a string and returns its hash.

Types

type Password

type Password interface {
	Hash(pwd string) (string, error)      // Hash takes a string and returns its hash.
	Compare(pwd string, hash string) bool // Compare takes a plaintext password and a hashed password, then checks if they match.
}
var Backend Password

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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