hashing

package
v0.0.0-...-5968118 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// algorithms
	SHA512     = "sha512"
	SHA256     = "sha256"
	SHA256Size = 32
	SHA512Size = 64

	// encodings
	UTF8   = "utf-8"
	Base64 = "base64"

	// hashers
	Pbkdf2Opt   = "pbkdf2"
	Argon2IDOpt = "argon2id"
	BcryptOpt   = "bcrypt"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HashComparer

type HashComparer interface {
	Hash(password string) (string, error)
	Compare(password, passwordHash string) bool
}

func NewArgon2IDHasher

func NewArgon2IDHasher(saltSize int, iterations int, keylen int, memory uint32, parallelism uint8) HashComparer

func NewBcryptHashComparer

func NewBcryptHashComparer(cost int) HashComparer

func NewHasher

func NewHasher(authOpts map[string]string, backend string) HashComparer

NewHasher returns a hasher depending on the given options.

func NewPBKDF2Hasher

func NewPBKDF2Hasher(saltSize int, iterations int, algorithm string, saltEncoding string, keyLen int) HashComparer

Jump to

Keyboard shortcuts

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