helpers

package
v0.0.0-...-ae0949c Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: MIT Imports: 24 Imported by: 0

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

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

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

RSA公钥私钥产生

func GetGuid

func GetGuid() string

生成GUID

func GetMd5String

func GetMd5String(s string) string

生成32位md5字串

func HashPassword

func HashPassword(password string) (string, error)

func MustUuid

func MustUuid() string

func NewPostId

func NewPostId() string

func NewUuid

func NewUuid() (string, error)

func RandNumberRunes

func RandNumberRunes(n int) string

func RandStringRunes

func RandStringRunes(n int) string

func RsaDecrypt

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

私钥解密

func RsaEncrypt

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

公钥加密

func RsaSignWithSha256

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

签名

func RsaVerySignWithSha256

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