person

package
v2.1.8 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Password

type Password struct {
	Code        string // code 随即码
	Salt        string // 盐
	SaltEncrypt string // 加密盐
}

func (*Password) Check

func (a *Password) Check(hashedPassword, password string) error

验证一个hash后的密码

func (*Password) DecryptAndCheck

func (a *Password) DecryptAndCheck(hashedPassword string, inputPass string) error

*

  • 解密密码
  • 原理: // AES-128-CBC {padding:Pkcs7,iv:salt}( // md5( md5(salt + 验证码)+sha512(单数位 salt) ).从第三个开始取16个长度 // AES-128-CBC {padding:Pkcs7,iv:md5(salt)的前16位}( // sha512(sha384(salt) + 验证码长度 + 验证码 + md5(双数位 salt)).从第十个开始取16个长度, // sha512(sha384(salt) + 验证码长度 + 验证码 + md5(双数位 salt)) + QQ 密码) // ) // 注: salt 长度必须为16

解密密码与验证

func (*Password) MakePassword

func (*Password) MakePassword(password string) (bcryptPass string, err error)

加密密码

func (*Password) RandSaltAndCode

func (a *Password) RandSaltAndCode(privateKey string) error

生产salt和code

Jump to

Keyboard shortcuts

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