hash

package
v0.0.0-...-c4ef65f Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// HashLen is the length of a marshaled Hash
	HashLen = hashOffset + keyLen
)

Variables

View Source
var (
	ErrInvalidHashLength = errors.New("invalid hash length")
	ErrInvalidPassword   = errors.New("invalid password")
)

hash errors

Functions

This section is empty.

Types

type Hash

type Hash struct {
	// contains filtered or unexported fields
}

Hash represents an argon2id key with all of its parameters

func New

func New(password []byte, time, memory uint32, threads uint8) (*Hash, error)

New returns a new Hash with the given password and parameters

func (*Hash) MarshalBinary

func (h *Hash) MarshalBinary() ([]byte, error)

MarshalBinary encodes h into binary form and returns the result

func (*Hash) UnmarshalBinary

func (h *Hash) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes data into h

func (*Hash) Validate

func (h *Hash) Validate(password []byte) error

Validate returns an error if the password cannot be validated against the Hash

Jump to

Keyboard shortcuts

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