bcrypt

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(l hclog.Logger) (crypto.EMCrypto, error)

New registers this crypto type for use by the NetAuth server.

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine binds the functions of the BCrypt Crypto system and satisfies the crypto.EMCrypto interface. The parameter 'cost' is used to set the cost of the algorithm and should be set on a per-site basis.

func (*Engine) SecureSecret

func (b *Engine) SecureSecret(secret string) (string, error)

SecureSecret takes in a secret and generates a bcrypt hash from it. This is then returned for storage in the database.

func (*Engine) VerifySecret

func (b *Engine) VerifySecret(secret, hash string) error

VerifySecret verifies a given secret against a given hash and returns either nil for a match or a crypto.ErrAuthorizationFailure in the case that the secret did not match the stored one.

Jump to

Keyboard shortcuts

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