passalt

package module
v0.0.0-...-ba9732c Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2017 License: MIT Imports: 8 Imported by: 0

README

passalt

Like werkzeug.security's generate_password_hash and check_password_hash, but in Go. The format of generated hashes is:

sha512$salt$hash

Install

$ go get github.com/anqurvanillapy/passalt

Usage

  • There are only two APIs, similar to those in werkzeug.security
    • passalt.New(passwd)
    • passalt.Check(hash, passwd)
import "github.com/anqurvanillapy/passalt"

func main() {
	// Generate the hash that is safe to store in your database.
	hash := passalt.New("foo")
	passalt.Check(hash, "foo")  // => true
	passalt.Check(hash, "bar")  // => false
}

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(token string, passwd string) bool

Check if the password is valid.

func New

func New(passwd string) string

New a password hash.

Types

This section is empty.

Jump to

Keyboard shortcuts

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