Documentation ¶
Index ¶
- Constants
- func BytesToString(b []byte) string
- func CompareSortedStrings(lhs, rhs []string) bool
- func Copy(toValue interface{}, fromValue interface{}) (err error)
- func DecryptDesEcb(src, key string, paddingType int) (d string, err error)
- func DiffStrings(oldStrings, newStrings []string) ([]string, []string)
- func EncryptDesEcb(src, key string, paddingType int) (e string, err error)
- func Exists(path string) bool
- func FileSize(file string) (int64, error)
- func Format(format string, t time.Time) string
- func GenUUID() string
- func GetClientIp(ctx *gin.Context) string
- func GetFormatRequestTime(time time.Time) string
- func GetFunctionName(i interface{}, seps ...rune) string
- func GetHandler(ctx *gin.Context) (handler string)
- func GetLocalIp() string
- func GetRequestCost(start, end time.Time) float64
- func GetUuidString() string
- func GetUuidUInt64() uint64
- func HashInt(s string) int64
- func Int64sContain(a []int64, x int64) bool
- func IntStringContain(a []string, x string) bool
- func IsExist(path string) bool
- func IsJsonMap(s string) bool
- func IsJsonSlice(s string) bool
- func IsJsonString(s string) bool
- func JoinArgs(showByte int, args ...interface{}) string
- func LoadConf(path string, cf interface{}) bool
- func LoadFile(path string) ([]byte, bool)
- func Md5(plain string) string
- func MultiJoinString(str ...string) string
- func PKCS5Padding(cipherText []byte) []byte
- func PKCS5UnPadding(origData []byte) []byte
- func PKCS7Padding(cipherText []byte, blockSize int) []byte
- func PKCS7UnPadding(origData []byte) []byte
- func RandNum(num ...int) int
- func Rc4Decode(key, encrypted string) (string, error)
- func Rc4DecodeBytes(key []byte, encrypted string) ([]byte, error)
- func Rc4Encode(key, plainText string) (string, error)
- func Rc4EncodeBytes(key, plainText []byte) (string, error)
- func SHA1()
- func SHA256()
- func SaveConf(conf interface{}, path string) bool
- func StrToUint(strNumber string, value interface{}) error
- func StringToBytes(s string) (b []byte)
- func StructToMap(obj interface{}) map[string]interface{}
- func UnmarshalJson(jsonVal []byte, objVal interface{}) error
- func ZeroPadding(cipherText []byte, blockSize int) []byte
- func ZeroUnPadding(origData []byte) []byte
- type BufferPool
- type Conf
Constants ¶
View Source
const ( PaddingTypePKCS7 = iota // 推荐使用 PaddingTypePKCS5 PaddingTypeZero // 不推荐使用 PaddingTypeNoPadding // 不要用 )
Variables ¶
This section is empty.
Functions ¶
func BytesToString ¶
BytesToString converts byte slice to string without a memory allocation.
func DecryptDesEcb ¶
ECB解密, 使用PKCS7进行填充
func DiffStrings ¶
return adds, dels
func EncryptDesEcb ¶
ECB加密, 使用PKCS7进行填充
func Format ¶
Format 格式化时间 This is an alternative to time.Format because no one knows what date 040305 is supposed to create when used as a 'layout' string this takes standard strftime format options. For a complete list of format options see http://strftime.org/
func GetClientIp ¶
过 ingress 的请求clientIp 优先从 "X-Original-Forwarded-For" 中获取
func GetFormatRequestTime ¶
func GetHandler ¶
func GetRequestCost ¶
func GetUuidString ¶
func GetUuidString() string
func GetUuidUInt64 ¶
func GetUuidUInt64() uint64
func Int64sContain ¶
func IntStringContain ¶
func IsJsonSlice ¶
func IsJsonString ¶
func MultiJoinString ¶
func PKCS5UnPadding ¶
func PKCS7Padding ¶
假设数据长度需要填充n(n>0)个字节才对齐,那么填充n个字节,每个字节都是n; 如果数据本身就已经对齐了,则填充一块长度为块大小的数据,每个字节都是块大小
func PKCS7UnPadding ¶
func Rc4EncodeBytes ¶
func StringToBytes ¶
StringToBytes converts string to byte slice without a memory allocation.
func StructToMap ¶
func StructToMap(obj interface{}) map[string]interface{}
func UnmarshalJson ¶
func ZeroPadding ¶
ZeroPadding,数据长度不对齐时使用0填充,否则不填充 只适合以\0结尾的字符串加解密
func ZeroUnPadding ¶
Types ¶
type BufferPool ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.