bcryptKit

package
v3.1.102 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareHashAndPassword added in v3.0.106

func CompareHashAndPassword(hashedPassword, plainPassword []byte) error

CompareHashAndPassword 验证密码是否正确(对比 已哈希过的密码 与 原始明文密码 是否匹配。).

@param hashedPassword GenerateFromPassword() 的返回值 @param plainPassword 密码明文 @return err == nil: 已哈希过的密码 与 原始明文密码 匹配

func GenerateFromPassword added in v3.0.106

func GenerateFromPassword(password []byte, costArgs ...int) (hashedPassword []byte, err error)

GenerateFromPassword 加密用户密码(生成一个带盐(salt)的哈希值).

@param costArgs 不传参将使用默认值(bcrypt.DefaultCost)

PS: (1) 通常用于安全地存储密码; (2) 传参相同,多次执行的结果不同.

Types

This section is empty.

Jump to

Keyboard shortcuts

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