crypto

package
v0.0.0-...-84a7560 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

README

Pbkdf2 算法

使用这个算法进行用户密码的加密与验证

md5 进行普通的加密与验证

Documentation

Index

Constants

View Source
const (
	KDF_PBKDF2 KDFType = "pbkdf2"

	PBKDF2_DEFAULT_ITERATION      = 20480
	PBKDF2_DEFAULT_SALT_BYTE_SIZE = 16
	PBKDF2_DEFAULT_KEY_BYTE_SIZE  = 64
)

Variables

View Source
var (
	ErrUnknownKDF = errors.New("unknown KDF")
)

Functions

func HashPassword

func HashPassword(password string) ([]byte, error)

func MD5

func MD5(password string) string

func MD5Verify

func MD5Verify(password, hashPassword string) bool

func VerifyPassword

func VerifyPassword(password string, hashPassword []byte) (bool, error)

Types

type KDFType

type KDFType string

type KeyHeader

type KeyHeader struct {
	KDF KDFType `json:"kdf"`
}

Jump to

Keyboard shortcuts

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