utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCacheNotFound = bigcache.ErrEntryNotFound

Functions

func Decrypt

func Decrypt(key, data, additionalData []byte) ([]byte, error)

Decrypt 解密。 key的长度16、24、32字节,分别对应AES-128、AES-192、AES-256加密算法, data是需要解密的数据, additionalData是用于进行身份验证的数据,按需使用,可以不用传。

func DecryptString

func DecryptString(key, data, additionalData string) (string, error)

DecryptString 解密。 key的长度16、24、32字节,分别对应AES-128、AES-192、AES-256加密算法, data是需要解密的数据, additionalData是用于进行身份验证的数据,按需使用,可以不用传。

func Encrypt

func Encrypt(key, data, additionalData []byte) ([]byte, error)

Encrypt 加密。 key的长度16、24、32字节,分别对应AES-128、AES-192、AES-256加密算法, data是需要加密的数据, additionalData是用于进行身份验证的数据,按需使用,可以不用传。

func EncryptString

func EncryptString(key, data, additionalData string) (string, error)

EncryptString 加密。 key的长度16、24、32字节,分别对应AES-128、AES-192、AES-256加密算法, data是需要加密的数据, additionalData是用于进行身份验证的数据,按需使用,可以不用传。

func GetCache

func GetCache() *bigcache.BigCache

func GetIP

func GetIP() (string, error)

func RandomBytes

func RandomBytes(length int) []byte

func RandomString

func RandomString(length int) string

func RandomStringFrom

func RandomStringFrom(length int, characters string) string

Types

type CloseFunc

type CloseFunc func()

func InitializeCache

func InitializeCache() CloseFunc

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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