hash

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: Apache-2.0, BSD-3-Clause, ISC 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{}

Bcrypt implements a bcrypt-based password hashing scheme.

func (Bcrypt) CheckHash

func (Bcrypt) CheckHash(secret, hash string) bool

CheckHash implements Hasher.

func (Bcrypt) Hash

func (Bcrypt) Hash(secret string) (string, error)

Hash implements Hasher.

type Hasher

type Hasher interface {
	// Hash creates a hash from a given input.
	Hash(secret string) (string, error)

	// CheckHash checks if a hash matches a given input.
	CheckHash(secret, hash string) bool
}

Hasher defines an interface for password hashers.

type Null

type Null struct{}

Null provides a hasher that returns the source input.

func (Null) CheckHash

func (Null) CheckHash(secret, hash string) bool

CheckHash implements Hasher.

func (Null) Hash

func (Null) Hash(secret string) (string, error)

Hash implements Hasher.

Jump to

Keyboard shortcuts

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