codec

package
v0.0.0-...-69bdcc1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultJwtExpire = time.Hour * 720
)

Variables

This section is empty.

Functions

func AesDecrypt

func AesDecrypt(encrypted, key []byte) (bts []byte, err error)

func AesEncrypt

func AesEncrypt(origData, key []byte) (bts []byte, err error)

func Ascii85Decode

func Ascii85Decode(data []byte) []byte

func Ascii85Encode

func Ascii85Encode(data []byte) []byte

func Base64Decode

func Base64Decode(data []byte) []byte

func Base64DecodeString

func Base64DecodeString(data string) []byte

func Base64Encode

func Base64Encode(data []byte) []byte

func Base64EncodeString

func Base64EncodeString(data []byte) string

func CsvToMap

func CsvToMap(reader io.Reader) (records []map[string]any)

func FNVHashU64

func FNVHashU64(src []byte) uint64

func GenToken

func GenToken(data *JwtData, secret []byte) (string, error)

GenToken 生成JWT

func GenTokenExpire

func GenTokenExpire(data *JwtData, secret []byte, expire time.Time) (string, error)

func GetExpireDate

func GetExpireDate() time.Time

func Md5

func Md5(input []byte) []byte

func Md5String

func Md5String(input []byte) string

func PKCS5Padding

func PKCS5Padding(ciphers []byte, blockSize int) []byte

func PKCS5UnPadding

func PKCS5UnPadding(origData []byte) []byte

func RowsToMap

func RowsToMap(rows [][]string) (records []map[string]any)

func StringHash64

func StringHash64(input string) int64

func StringHashU64

func StringHashU64(src string) uint64

Types

type JwtClaims

type JwtClaims struct {
	jwt.RegisteredClaims
	*JwtData
}

func ParseToken

func ParseToken(tokenStr string, secret []byte) (*JwtClaims, error)

ParseToken 解析JWT

type JwtData

type JwtData struct {
	UID     int64  `json:"uid,omitempty"`
	Name    string `json:"name,omitempty"`
	Version int64  `json:"version,omitempty"`
}

Jump to

Keyboard shortcuts

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