Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigArgon2ID ¶
type ConfigArgon2ID struct { Type Type Memory uint32 Iterations uint32 Parallelism uint8 SaltLength uint32 KeyLength uint32 Salt []byte }
ConfigArgon2ID - configuration details for argon2id
func DefaultConfigArgon2ID ¶ added in v1.2.0
func DefaultConfigArgon2ID() (kdfA *ConfigArgon2ID)
DefaultConfigArgon2ID - returns default configuration for Argon2ID
func (*ConfigArgon2ID) Instance ¶ added in v1.2.0
func (aCfg *ConfigArgon2ID) Instance() (cfg any)
type ConfigPBKDF2 ¶
type ConfigPBKDF2 struct { Type Type Iterations int SaltLength uint32 KeyLength int HashFunc THashFunc Salt []byte // contains filtered or unexported fields }
ConfigPBKDF2 - configuration details for pbkdf2
func DefaultConfigPBKDF2 ¶ added in v1.2.0
func DefaultConfigPBKDF2() (kdfP *ConfigPBKDF2)
DefaultConfigPBKDF2 - returns default configuration for PBKDF2
func (*ConfigPBKDF2) Instance ¶ added in v1.2.0
func (pCfg *ConfigPBKDF2) Instance() (cfg any)
type KDF ¶
type KDF interface { SetSalt(salt []byte) Generate(input []byte) Verify(input []byte) (ok bool) Key() (key []byte) String() (str string) }
KDF - interface for different implementations of key derivation functions
func New ¶
func New[T *ConfigArgon2ID | *ConfigPBKDF2](cfg T) (k KDF, err error)
type KDFArgon2ID ¶
type KDFArgon2ID struct { *ConfigArgon2ID // contains filtered or unexported fields }
KDFArgon2ID - structure for argon2id key derivation function
func NewKDFArgon2ID ¶
func NewKDFArgon2ID(cfg *ConfigArgon2ID) (a *KDFArgon2ID)
NewKDFArgon2ID - creates a new instance of Argon2ID using the given configuration parameters
func ParseArgon2ID ¶
func ParseArgon2ID(inputStr string) (a *KDFArgon2ID, err error)
ParseArgon2ID - parses an argon2id output format and generates a KDF with the configuration
func (*KDFArgon2ID) Generate ¶
func (a *KDFArgon2ID) Generate(input []byte)
Generate - generates a input from the input
func (*KDFArgon2ID) SetSalt ¶ added in v1.1.0
func (a *KDFArgon2ID) SetSalt(salt []byte)
SetSalt - sets a custom salt
func (*KDFArgon2ID) String ¶
func (a *KDFArgon2ID) String() (str string)
String - returns an encoded representation of the derived key with the parameters used
func (*KDFArgon2ID) Verify ¶
func (a *KDFArgon2ID) Verify(input []byte) (ok bool)
Verify - verifies a given input with what is stored
type KDFPBKDF2 ¶
type KDFPBKDF2 struct { *ConfigPBKDF2 // contains filtered or unexported fields }
KDFPBKDF2 - structure for pkbdf2 key derivation function
func NewKDFPBKDF2 ¶
func NewKDFPBKDF2(cfg *ConfigPBKDF2) (p *KDFPBKDF2)
NewKDFPBKDF2 - creates a new instance of PBKDF2 using the given configuration parameters
func ParsePBKDF2 ¶
ParsePBKDF2 - parses an pbkdf2 output format and generates a KDF with the configuration