passhash

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bcrypt

type Bcrypt struct{}

Bcrypt implements the PasswordHasher interface using bcrypt

func (Bcrypt) Compare

func (h Bcrypt) Compare(password, hash []byte) bool

Compare returns true if the given password corresponds to the given hash, otherwise returns false

func (Bcrypt) Hash

func (h Bcrypt) Hash(password []byte) ([]byte, error)

Hash salts and hashes the given password returning the resulting hash

type Mock

type Mock struct{}

Mock implements the PasswordHasher interface using bcrypt

func (Mock) Compare

func (h Mock) Compare(password, hash []byte) bool

Compare returns true if the given password corresponds to the given hash, otherwise returns false

func (Mock) Hash

func (h Mock) Hash(password []byte) ([]byte, error)

Hash salts and hashes the given password returning the resulting hash

type PasswordHasher

type PasswordHasher interface {
	// Hash must salt and hash the given password returning the resulting hash
	Hash(password []byte) ([]byte, error)

	// Compare must return true if the given password corresponds to
	// the given hash, otherwise must return false
	Compare(password, hash []byte) bool
}

PasswordHasher defines the interface of a password hasher

Jump to

Keyboard shortcuts

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