managers

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseHasherIdentifiers

type BaseHasherIdentifiers int

/ The type to Identify the Basic Hasher Identifiers

const (
	HasherBase BaseHasherIdentifiers = iota
	HasherMD5
	HasherSHA256
	HasherSHA512
	HasherPBKDFSHA512

	HasherFastest   = HasherBase
	HasherStrongest = HasherPBKDFSHA512
)

func (BaseHasherIdentifiers) DoHash

func (b BaseHasherIdentifiers) DoHash(toHash, salt []byte) []byte

func (BaseHasherIdentifiers) GetMagicTag

func (b BaseHasherIdentifiers) GetMagicTag() [4]byte

func (BaseHasherIdentifiers) GetSaltLen

func (b BaseHasherIdentifiers) GetSaltLen(_ []byte) int

func (BaseHasherIdentifiers) Match

func (b BaseHasherIdentifiers) Match(hash, salt, input []byte) (bool, error)

type HasherManager

type HasherManager struct {
	managers.BaseManager

	UserHashers map[[4]byte]HasherVersion
	// contains filtered or unexported fields
}

func (*HasherManager) Hash

func (h *HasherManager) Hash(toHash []byte, version HasherVersion) (hash []byte, salt []byte, err error)

func (*HasherManager) HashB64

func (h *HasherManager) HashB64(toHash []byte, version HasherVersion) (hash, salt string, err error)

func (*HasherManager) Id

func (h *HasherManager) Id() string

func (*HasherManager) Verify

func (h *HasherManager) Verify(hash, salt, input []byte, version HasherVersion) (bool, error)

func (*HasherManager) VerifyB64

func (h *HasherManager) VerifyB64(hash, salt string, input []byte, version HasherVersion) (bool, error)

type HasherVersion

type HasherVersion interface {
	GetMagicTag() [4]byte
	GetSaltLen(toHash []byte) int
	DoHash(toHash, salt []byte) []byte
	Match(hash, salt, input []byte) (bool, error)
}

Jump to

Keyboard shortcuts

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