kdf

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PbKdf2 = Pbkdf2Key{}

Functions

This section is empty.

Types

type Hash

type Hash []byte

type Key

type Key interface {
	// String convert this Key to a string in the form of `$algo;{any number of algorithm defined fields}`
	String() string
	// FromString read the string form of a Key into a Key implementer instance
	FromString(string) (Key, error)
	// Equals given the Key it's called on and a string, make a new Key with the same params as the referenced Key
	// and compare them in constant time
	Equals(other string) bool
	GetKey() []byte
	GetSalt() []byte
}

Key is the interface abstracting over the supported Key derivation functions in this package

type Pbkdf2Key

type Pbkdf2Key struct {
	Hash
	Salt
	Algo     string
	Iter     uint64
	KeyLen   uint64
	HashType string
}

Pbkdf2Key represents a key derived using the PBKDF2 algorithm. It contains the following fields: - Hash: The derived key - Salt: The salt value used for key derivation - Algo: The algorithm used for key derivation - Iter: The number of iterations used for key derivation - KeyLen: The length of the derived key - HashType: The hash function used for key derivation

func (*Pbkdf2Key) Equals

func (d *Pbkdf2Key) Equals(other string) bool

func (*Pbkdf2Key) FromString

func (*Pbkdf2Key) FromString(s string) (Key, error)

func (*Pbkdf2Key) GetKey

func (d *Pbkdf2Key) GetKey() []byte

func (*Pbkdf2Key) GetSalt

func (d *Pbkdf2Key) GetSalt() []byte

func (Pbkdf2Key) Key

func (Pbkdf2Key) Key(value []byte, iter int, keyLen int, h func() hash.Hash) Key

func (Pbkdf2Key) KeyFromStr

func (Pbkdf2Key) KeyFromStr(value string, iter int, keyLen int, h func() hash.Hash) Key

func (*Pbkdf2Key) String

func (d *Pbkdf2Key) String() string

type Salt

type Salt []byte

Jump to

Keyboard shortcuts

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