gauth

package
v1.0.27 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSecretKey

func GenerateSecretKey(seed string) (string, error)

生成随机密钥,输出结果是经过base32编码

func GenerateSeed

func GenerateSeed() string

* @生成密钥种子

func GetNewCode

func GetNewCode(secretKey string, curTimeSlice int64) uint32

* @生成code验证码 * @secretKey 密钥 * @curTimeSlice 当前时间戳 - time.Now().Unix()

func SHA1

func SHA1(data []byte) []byte

func SHA1PRNG

func SHA1PRNG(seed []byte, size int) ([]byte, error)

func SHA512

func SHA512(data []byte) []byte

func ValidCode

func ValidCode(secretKey string, code uint32, size ...int) bool

* @校验code有效性 * @secretKey 密钥 * @code 验证码 * @size 偏移时间 s >= 1 && s <= 17

Types

This section is empty.

Jump to

Keyboard shortcuts

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