helpers

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: MIT Imports: 24 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecrypt

func AesDecrypt(str string, key []byte) (ret string, err error)

func AesDecryptBytes

func AesDecryptBytes(bytes []byte, key []byte) ([]byte, error)

func AesEncrypt

func AesEncrypt(str string, key []byte) (string, error)

func AesEncryptBytes

func AesEncryptBytes(bytes []byte, key []byte) ([]byte, error)

func CalcPostId

func CalcPostId() uint64

func CalcUserID

func CalcUserID(email string) uint64

func CheckPasswordHash added in v0.1.1

func CheckPasswordHash(password, hash string) bool

func DecodeId

func DecodeId(str string) (uint64, error)

func EncodeId

func EncodeId(id uint64) string

func EqString

func EqString(a interface{}, b string) bool

func FmtTime

func FmtTime(t time.Time) string

func FmtTimeUnix

func FmtTimeUnix(unix int64) string

func FuncMap

func FuncMap() template.FuncMap

func GenRsaKey added in v0.1.1

func GenRsaKey() (prvkey, pubkey []byte)

RSA公钥私钥产生

func GetGuid

func GetGuid() string

生成GUID

func GetMd5String

func GetMd5String(s string) string

生成32位md5字串

func HashPassword added in v0.1.1

func HashPassword(password string) (string, error)

func MustUuid added in v0.1.1

func MustUuid() string

func NewPostId

func NewPostId() string

func NewUuid added in v0.1.1

func NewUuid() (string, error)

func RandNumberRunes added in v0.1.1

func RandNumberRunes(n int) string

func RandStringRunes added in v0.1.1

func RandStringRunes(n int) string

func RsaDecrypt added in v0.1.1

func RsaDecrypt(ciphertext, keyBytes []byte) ([]byte, error)

私钥解密

func RsaEncrypt added in v0.1.1

func RsaEncrypt(data, keyBytes []byte) ([]byte, error)

公钥加密

func RsaSignWithSha256 added in v0.1.1

func RsaSignWithSha256(data []byte, keyBytes []byte) []byte

签名

func RsaVerySignWithSha256 added in v0.1.1

func RsaVerySignWithSha256(data, signData, keyBytes []byte) bool

验证

Types

This section is empty.

Jump to

Keyboard shortcuts

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