kdf

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: ISC Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const MarshaledLen = 25

MarshaledLen is the length of the marshaled KDF parameters.

Variables

This section is empty.

Functions

func DeriveKey

func DeriveKey(password []byte, p *Argon2idParams, len uint32) []byte

DeriveKey derives a key of len bytes from a passphrase and KDF parameters.

Types

type Argon2idParams

type Argon2idParams struct {
	Salt    [16]byte
	Time    uint32
	Memory  uint32
	Threads uint8
}

Argon2idParams describes the difficulty and parallelism requirements for the Argin2id KDF.

func NewArgon2idParams

func NewArgon2idParams(rand io.Reader) (*Argon2idParams, error)

NewArgon2idParams returns the minimum recommended parameters for the Argon2id KDF with a random salt. Randomness is read from rand.

The time and memory parameters may be increased by an application when stronger security requirements are desired, and additional memory is available.

func (*Argon2idParams) MarshalBinary

func (p *Argon2idParams) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler. The returned byte slice has length MarshaledLen.

func (*Argon2idParams) UnmarshalBinary

func (p *Argon2idParams) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

Jump to

Keyboard shortcuts

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