utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidHash         = errors.New("invalid hash format")
	ErrIncompatibleVersion = errors.New("incompatible version of argon2")
)

Functions

func ComparePasswordAndHash

func ComparePasswordAndHash(password, encodedHash string) (match bool, err error)

func GenerateRandomBytes

func GenerateRandomBytes(n int) ([]byte, error)

func GenerateRandomString

func GenerateRandomString(n int) (string, error)

func HashPassword

func HashPassword(password string) (string, error)

HashPassword hashes a password using Argon2id using the following parameters: - memory: 46 MiB - threads: 2 - time: 2 iterations - keyLength: 32 bytes - saltLength: 16 bytes The resulting hash is encoded in a format compatible with the Argon2 specification.

Types

This section is empty.

Jump to

Keyboard shortcuts

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