Documentation
¶
Overview ¶
Package pbkdf2 exposes the PBKDF2-SHA512 key stretching implementation used by ksf.
Index ¶
Constants ¶
const ( // Name is the string identifier for the PBKDF2 key stretching function. Name = "PBKDF2-SHA512" // RecommendedSaltLength is the RFC recommended salt length for the PBKDF2 key stretching function. RecommendedSaltLength = 8 // DefaultIterations is the default iterations parameter for the PBKDF2 key stretching function. DefaultIterations = 10000 )
Variables ¶
var ( // ErrParams indicates an invalid amount of PBKDF2 parameters. ErrParams = errors.New("invalid amount of PBKDF2 parameters") // ErrParameterValue indicates that one or more PBKDF2 parameters have invalid values. ErrParameterValue = errors.New("invalid PBKDF2 parameter value") // ErrOutputLength indicates that the requested derived key length is invalid. ErrOutputLength = errors.New("invalid PBKDF2 output length") )
Functions ¶
func DefaultParameters ¶
func DefaultParameters() []uint64
DefaultParameters returns the default PBKDF2 iterations parameter as a slice of uint64.
func Harden ¶
Harden uses the PBKDF2 key stretching function to derive a key from the password and salt. The parameter must be empty or a single value representing the number of iterations. If no parameters are provided, the recommended default values will be used.
func UnsafeHarden ¶
UnsafeHarden is the same as Harden but panics on an invalid parameter. It is safe to use if the parameter has previously been validated by ValidateParameters.
func ValidateParameters ¶
ValidateParameters checks if the provided parameter is valid for the PBKDF2 key stretching function. The parameter must be empty or a single value representing the number of iterations.
Types ¶
This section is empty.