kdf

package
v0.0.0-...-b0d9e68 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BCRYPT = "bcrypt"
	PBKDF2 = "pbkdf2"
	SCRYPT = "scrypt"
	ARGON2 = "argon2"
)

Variables

This section is empty.

Functions

func GenerateRandomPassword

func GenerateRandomPassword(length int, minClasses int) (string, error)

GenerateRandomPassword generate random password

Types

type KDF

type KDF interface {
	// DeriveKeyByPassword derive key by password
	DeriveKeyByPassword(password string) (deriveKey []byte, err error)

	// VerifyDeriveKeyStr verify deriveKeyStr
	VerifyDeriveKeyStr(kdfKeyStr string, password []byte) (isOk bool, err error)

	// GetDeriveKeyStr get deriveKeyStr
	GetDeriveKeyStr() string

	// KDFName get kdf name
	KDFName() string
}

KDF interface

func InitKdf

func InitKdf(kdfName string, keyLen int) (KDF, error)

InitKdf init kdf by kdfName. Note: param '-1' means use default value. TODO: refactor this

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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