Documentation ¶
Index ¶
- func ComputeHmacSha256(message string, secret string) string
- func Encode(rawPwd string, options *Options) (string, string)
- func GetRemoteClientIp(r *http.Request) string
- func GetWithHeader(path string, m map[string]string, proxy string) ([]byte, error)
- func ISO(t time.Time) string
- func Post(url string, params any) ([]byte, error)
- func Rand4Num() string
- func ToFloat64(str string) float64
- func ToInt64(str string) int64
- func ToTimeString(mill int64) string
- func Unq(prefix string) string
- func Verify(rawPwd string, salt string, encodedPwd string, options *Options) bool
- func ZeroTime() int64
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeHmacSha256 ¶
func Encode ¶
Encode takes two arguments, a raw password, and a pointer to an Options struct. In order to use default options, pass `nil` as the second argument. It returns the generated salt and encoded key for the user.
func GetRemoteClientIp ¶
func GetWithHeader ¶
func ToTimeString ¶
Types ¶
type Options ¶
Options is a struct for custom values of salt length, number of iterations, the encoded key's length, and the hash function being used. If set to `nil`, default options are used: &Options{ 64, 10000, 128, "sha512" } SaltLen:用户生成的长度,默认64 Iterations: PBKDF2函数中的迭代次数,默认10000 KeyLen:BKDF2函数中编码密钥的长度,默认128 HashFunction: 使用的哈希算法,默认sha512
Source Files ¶
Click to show internal directories.
Click to hide internal directories.