auth

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(hash, password string) bool

CheckPassword is a boolean wrapper for VerifyPassword.

func HashPassword

func HashPassword(password string, cost int) (string, error)

HashPassword generates a bcrypt hash for the given password. - Uses bcrypt.MinCost / DefaultCost / MaxCost to bound the cost and avoid magic numbers. - When cost < MinCost, falls back to DefaultCost; when cost > MaxCost, caps at MaxCost.

func VerifyPassword

func VerifyPassword(hash, password string) error

VerifyPassword compares a bcrypt hash with a plaintext password. - Returns nil if they match; returns an error if they do not match or hash is invalid.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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