Documentation ¶
Overview ¶
AES CBC PKCS5Padding加/解密
使用 hex.Encode
查看测试文件: aes_cbc_test.go
memory cache util
http client 使用github.com/imroc/req库 返回string,如果需要到struct,需要自己反序列化
Index ¶
- func AESDecrypt(decodeStr string, key string) (string, error)
- func AESEncrypt(plainText string, key string) string
- func Decrypt(data []byte, key []byte) []byte
- func Encrypt(data []byte, key []byte) []byte
- func FileExist(file string) error
- func GetUUID() (string, error)
- func GobDecode(data []byte, to interface{}) error
- func GobEncode(data interface{}) ([]byte, error)
- func HttpGet(url string) (ret string, err error)
- func HttpPost(url string, param req.Param) (ret string, err error)
- func IntDateTime(val int64) (ret string)
- func IntDateTimeFormat(val int64, format string) (ret string)
- func MD5(str string) string
- func PKCS5Padding(cipherText []byte, blockSize int, after int) []byte
- func PKCS5UnPadding(origData []byte) []byte
- func TimeFormat(t time.Time, format string) string
- type MemoryCache
- type XXTea
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
Decrypt the data with key. data is the bytes to be decrypted. key is the decrypted key. It is the same as the encrypt key.
func Encrypt ¶
Encrypt the data with key. data is the bytes to be encrypted. key is the encrypt key. It is the same as the decrypt key.
func IntDateTimeFormat ¶
DateTimeFormat DateTimeFormat
func PKCS5Padding ¶
PKCS5Padding PKCS5Padding
Types ¶
type MemoryCache ¶ added in v0.2.2
type MemoryCache struct {
// contains filtered or unexported fields
}
MemoryCache memory cache struct
func NewMemoryCache ¶ added in v0.2.2
func NewMemoryCache(defaultHour, cleanupInterval int) *MemoryCache
NewMemoryCache return a new memory cache
func (*MemoryCache) GetCache ¶ added in v0.2.2
func (m *MemoryCache) GetCache(key string, to interface{}) (ok bool, err error)
GetCache return cache data
func (*MemoryCache) RemoveCache ¶ added in v0.2.2
func (m *MemoryCache) RemoveCache(key string) error
RemoveCache delete cache
func (*MemoryCache) SetCache ¶ added in v0.2.2
func (m *MemoryCache) SetCache(key string, value interface{}) error
SetCache set cache to key and return error
type XXTea ¶
type XXTea struct {
Key string
}
func (*XXTea) DecryptString ¶
DecryptString DecryptString
func (*XXTea) EncryptString ¶
EncryptString EncryptString