crypto

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultCost is the default bcrypt cost
	DefaultCost = 12
)

Variables

View Source
var (
	// ErrPasswordTooShort is returned when password is too short
	ErrPasswordTooShort = errors.New("password must be at least 8 characters long")

	// ErrPasswordTooLong is returned when password is too long
	ErrPasswordTooLong = errors.New("password must be at most 72 characters long")

	// ErrPasswordMismatch is returned when passwords don't match
	ErrPasswordMismatch = errors.New("passwords do not match")
)

Functions

func ComparePassword

func ComparePassword(hashedPassword, password string) bool

ComparePassword compares a password with a hash Returns true if the password matches the hash

func HashPassword

func HashPassword(password string) (string, error)

HashPassword generates a bcrypt hash of the password

func ValidatePasswordStrength

func ValidatePasswordStrength(password string) error

ValidatePasswordStrength validates password strength requirements

Types

This section is empty.

Jump to

Keyboard shortcuts

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