hasher

package
v0.0.0-...-47ace37 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: MIT Imports: 1 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 {
	// contains filtered or unexported fields
}

BCrypt is a Hasher that use the bcrypt algorithm

func (BCrypt) Compare

func (bc BCrypt) Compare(hashedPassword, password []byte) bool

Compare implements the Hasher interface

func (BCrypt) Hash

func (bc BCrypt) Hash(password []byte) ([]byte, error)

Hash implements the Hasher interface

type Hasher

type Hasher interface {

	// Hash returns the hash of its argument
	Hash(b []byte) ([]byte, error)

	// Compare compares the hashed password with a plaintext password
	// It returns true in case of successfull comparation, false otherwise
	Compare(hash, b []byte) bool
}

Hasher can generates hashes from plaintext password and compare hashes with plaintext passwords

func NewBCrypt

func NewBCrypt() Hasher

NewBCrypt allocates a new BCrypt instance

Jump to

Keyboard shortcuts

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