Documentation
¶
Index ¶
- Constants
- func AddString(s ...string) string
- func AddStringBytes(s ...string) []byte
- func AesCBCDeB58(s string, key []byte) []byte
- func AesCBCDeB64(s string, key []byte) []byte
- func AesCBCDeHex(s string, key []byte) []byte
- func AesCBCDePKCS7B58(s string, key []byte) []byte
- func AesCBCDePKCS7B64(s string, key []byte) []byte
- func AesCBCDePKCS7Hex(s string, key []byte) []byte
- func AesCBCDePKCS7StringB58(s string, key []byte) string
- func AesCBCDePKCS7StringB64(s string, key []byte) string
- func AesCBCDePKCS7StringHex(s string, key []byte) string
- func AesCBCDeStringB58(s string, key []byte) string
- func AesCBCDeStringB64(s string, key []byte) string
- func AesCBCDeStringHex(s string, key []byte) string
- func AesCBCDecrypt(asPKCS7 bool, ciphertext, key []byte, ivs ...[]byte) (plaintext []byte)
- func AesCBCDecryptE(asPKCS7 bool, ciphertext, key []byte, ivs ...[]byte) ([]byte, error)
- func AesCBCEnB58(b, key []byte) string
- func AesCBCEnB64(b, key []byte) string
- func AesCBCEnHex(b, key []byte) string
- func AesCBCEnPKCS7B58(b, key []byte) string
- func AesCBCEnPKCS7B64(b, key []byte) string
- func AesCBCEnPKCS7Hex(b, key []byte) string
- func AesCBCEnPKCS7StringB58(s string, key []byte) string
- func AesCBCEnPKCS7StringB64(s string, key []byte) string
- func AesCBCEnPKCS7StringHex(s string, key []byte) string
- func AesCBCEnStringB58(s string, key []byte) string
- func AesCBCEnStringB64(s string, key []byte) string
- func AesCBCEnStringHex(s string, key []byte) string
- func AesCBCEncrypt(asPKCS7 bool, plaintext, key []byte, ivs ...[]byte) (ciphertext []byte)
- func AesCBCEncryptE(asPKCS7 bool, plaintext, key []byte, ivs ...[]byte) ([]byte, error)
- func AesGCMDeB58(s string, key, nonce []byte) []byte
- func AesGCMDeB64(s string, key, nonce []byte) []byte
- func AesGCMDeHex(s string, key, nonce []byte) []byte
- func AesGCMDeStringB58(s string, key, nonce []byte) string
- func AesGCMDeStringB64(s string, key, nonce []byte) string
- func AesGCMDeStringHex(s string, key, nonce []byte) string
- func AesGCMDecrypt(ciphertext, key, nonce []byte) (plaintext []byte)
- func AesGCMDecryptWithNonce(ciphertext, key, nonce, additionalData []byte) ([]byte, error)
- func AesGCMEnB58(b, key []byte) (string, []byte)
- func AesGCMEnB64(b, key []byte) (string, []byte)
- func AesGCMEnHex(b, key []byte) (string, []byte)
- func AesGCMEnStringB58(s string, key []byte) (string, []byte)
- func AesGCMEnStringB64(s string, key []byte) (string, []byte)
- func AesGCMEnStringHex(s string, key []byte) (string, []byte)
- func AesGCMEncrypt(plaintext, key []byte) (ciphertext []byte, nonce []byte)
- func AesGCMEncryptWithNonce(plaintext, key, nonce, additionalData []byte) ([]byte, []byte, error)
- func AssertEqual(t testing.TB, expected, actual interface{}, description ...string)
- func AssertPanics(t *testing.T, title string, f func())
- func B2S(b []byte) string
- func B64Decode(s string) []byte
- func B64Encode(b []byte) string
- func B64UrlDecode(s string) []byte
- func B64UrlEncode(b []byte) string
- func BigComma(b *big.Int) string
- func BigCommaf(v *big.Float) string
- func Bigoom(n, b *big.Int) (float64, int)
- func CallPath() string
- func Comma(v int64) string
- func Commaf(v float64) string
- func Commai(v int) string
- func Commau(v uint64) string
- func CopyB2S(b []byte) string
- func CopyBytes(b []byte) []byte
- func CopyS2B(s string) []byte
- func CopyString(s string) string
- func Decrypt(value, secret string) string
- func DesCBCDeB58(s string, key []byte) []byte
- func DesCBCDeB64(s string, key []byte) []byte
- func DesCBCDeHex(s string, key []byte) []byte
- func DesCBCDePKCS7B58(s string, key []byte) []byte
- func DesCBCDePKCS7B64(s string, key []byte) []byte
- func DesCBCDePKCS7Hex(s string, key []byte) []byte
- func DesCBCDePKCS7StringB58(s string, key []byte) string
- func DesCBCDePKCS7StringB64(s string, key []byte) string
- func DesCBCDePKCS7StringHex(s string, key []byte) string
- func DesCBCDeStringB58(s string, key []byte) string
- func DesCBCDeStringB64(s string, key []byte) string
- func DesCBCDeStringHex(s string, key []byte) string
- func DesCBCDecrypt(asPKCS7 bool, ciphertext, key []byte, ivs ...[]byte) (plaintext []byte)
- func DesCBCDecryptE(asPKCS7 bool, ciphertext, key []byte, ivs ...[]byte) ([]byte, error)
- func DesCBCEnB58(b, key []byte) string
- func DesCBCEnB64(b, key []byte) string
- func DesCBCEnHex(b, key []byte) string
- func DesCBCEnPKCS7B58(b, key []byte) string
- func DesCBCEnPKCS7B64(b, key []byte) string
- func DesCBCEnPKCS7Hex(b, key []byte) string
- func DesCBCEnPKCS7StringB58(s string, key []byte) string
- func DesCBCEnPKCS7StringB64(s string, key []byte) string
- func DesCBCEnPKCS7StringHex(s string, key []byte) string
- func DesCBCEnStringB58(s string, key []byte) string
- func DesCBCEnStringB64(s string, key []byte) string
- func DesCBCEnStringHex(s string, key []byte) string
- func DesCBCEncrypt(asPKCS7 bool, plaintext, key []byte, ivs ...[]byte) (ciphertext []byte)
- func DesCBCEncryptE(asPKCS7 bool, plaintext, key []byte, ivs ...[]byte) ([]byte, error)
- func EncodeUUID(id []byte) []byte
- func Encrypt(value, secret string) string
- func Executable(evalSymlinks ...bool) string
- func ExecutableDir(evalSymlinks ...bool) string
- func GenRSAKey(bits int) (publicKey, privateKey []byte)
- func Get0Hour(t time.Time) time.Time
- func Get0LastMonth(t time.Time) time.Time
- func Get0LastWeek(t time.Time) time.Time
- func Get0Minute(t time.Time) time.Time
- func Get0Month(t time.Time) time.Time
- func Get0NextMonth(t time.Time) time.Time
- func Get0NextWeek(t time.Time) time.Time
- func Get0Second(t time.Time) time.Time
- func Get0Tomorrow(t time.Time) time.Time
- func Get0Week(t time.Time) time.Time
- func Get0Yesterday(t time.Time) time.Time
- func GetBytes(v interface{}, defaultVal ...[]byte) []byte
- func GetInt(v interface{}, defaultInt ...int) int
- func GetMonthDays(t time.Time) int
- func GetNotInternalIPv4(ip, defaultIP net.IP, flag ...bool) net.IP
- func GetNotInternalIPv4String(ip, defaultIP string, flag ...bool) string
- func GetSafeB2S(b []byte, defaultVal ...string) string
- func GetSafeBytes(b []byte, defaultVal ...[]byte) []byte
- func GetSafeS2B(s string, defaultVal ...[]byte) []byte
- func GetSafeString(s string, defaultVal ...string) string
- func GetString(v interface{}, defaultVal ...string) string
- func GetenvDecrypt(key string, secret string) string
- func Hash(b []byte, h hash.Hash) []byte
- func Hmac(b []byte, key []byte, h func() hash.Hash) []byte
- func HmacSHA1(b, key []byte) []byte
- func HmacSHA1Hex(s, key string) string
- func HmacSHA256(b, key []byte) []byte
- func HmacSHA256Hex(s, key string) string
- func HmacSHA512(b, key []byte) []byte
- func HmacSHA512Hex(s, key string) string
- func HumanBaseBytes(v uint64, base float64, sizes []string) string
- func HumanBytes(v uint64) string
- func HumanIBytes(v uint64) string
- func HumanIntBytes(v int) string
- func HumanIntIBytes(v int) string
- func IPv42Long(ip net.IP) int
- func IPv4String2Long(ip string) int
- func InInts(slice []int, n int) bool
- func InStrings(ss []string, s string) bool
- func IsDir(s string) bool
- func IsExist(s string) bool
- func IsFile(s string) bool
- func IsInternalIPv4(ip net.IP) bool
- func IsInternalIPv4String(ip string) bool
- func IsNil(i interface{}) bool
- func JoinBytes(b ...[]byte) []byte
- func Logn(n, b float64) float64
- func Long2IPv4(n int) net.IP
- func Long2IPv4String(n int) string
- func MD5(b []byte) []byte
- func MD5Hex(s string) string
- func MD5Reader(r io.Reader) (string, error)
- func MD5Sum(filename string) (string, error)
- func MaxInt(a, b int) int
- func MinInt(a, b int) int
- func MustBool(v interface{}) bool
- func MustInt(v interface{}) int
- func MustJSON(v interface{}) []byte
- func MustJSONIndent(v interface{}) []byte
- func MustJSONIndentString(v interface{}) string
- func MustJSONString(v interface{}) string
- func MustString(v interface{}) string
- func Padding(b []byte, bSize int, pkcs7 bool) []byte
- func ParseHumanBytes(s string) (uint64, error)
- func ParsePrivateKey(privateKey []byte) (priv *rsa.PrivateKey, err error)
- func ParsePublicKey(publicKey []byte) (pub *rsa.PublicKey, err error)
- func RSADecrypt(ciphertext, privateKey []byte) ([]byte, error)
- func RSAEncrypt(plaintext, publicKey []byte) ([]byte, error)
- func RSASign(data, privateKey []byte) ([]byte, error)
- func RSASignVerify(data, publicKey, sig []byte) error
- func RandBytes(n int) []byte
- func RandHex(nHalf int) string
- func RandInt(min int, max int) int
- func RandString(n int) string
- func Round(v float64, precision int) float64
- func RunPath() string
- func S2B(s string) []byte
- func SearchInt(slice []int, n int) int
- func SearchString(ss []string, s string) int
- func SetenvEncrypt(key, value, secret string) (string, error)
- func Sha1(b []byte) []byte
- func Sha1Hex(s string) string
- func Sha256(b []byte) []byte
- func Sha256Hex(s string) string
- func Sha512(b []byte) []byte
- func Sha512Hex(s string) string
- func Str2Bytes(s string) (b []byte)
- func StrToBytes(s string) []byte
- func String2Bytes(s string) (b []byte)
- func StringToBytes(s string) (b []byte)
- func UUID() []byte
- func UUIDShort() string
- func UUIDSimple() string
- func UUIDString() string
- func UnPadding(b []byte, pkcs7 bool) []byte
- func WaitNextMinute()
- func WeightedChoiceIndex(choices []TChoice) int
- func WeightedChoiceMap(choices map[interface{}]int) interface{}
- func WeightedChoiceWeightsIndex(weights []int) int
- func XOR(src, key []byte) []byte
- func XORDeB58(s string, key []byte) []byte
- func XORDeB64(s string, key []byte) []byte
- func XORDeHex(s string, key []byte) []byte
- func XORDeStringB58(s string, key []byte) string
- func XORDeStringB64(s string, key []byte) string
- func XORDeStringHex(s string, key []byte) string
- func XORE(src, key []byte) ([]byte, error)
- func XOREnB58(b, key []byte) string
- func XOREnB64(b, key []byte) string
- func XOREnHex(b, key []byte) string
- func XOREnStringB58(s string, key []byte) string
- func XOREnStringB64(s string, key []byte) string
- func XOREnStringHex(s string, key []byte) string
- type TChoice
Constants ¶
const ( Byte = 1 << (iota * 10) KiByte MiByte GiByte TiByte PiByte EiByte )
Ref: dustin/go-humanize IEC Sizes. kibis of bits
const ( IByte = 1 KByte = IByte * 1000 MByte = KByte * 1000 GByte = MByte * 1000 TByte = GByte * 1000 PByte = TByte * 1000 EByte = PByte * 1000 )
SI Sizes.
Variables ¶
This section is empty.
Functions ¶
func AddStringBytes ¶
AddStringBytes 拼接字符串, 返回 bytes from bytes.Join()
func AesCBCDeB58 ¶ added in v0.0.3
AesCBCDeB58 解密, ZerosPadding
func AesCBCDePKCS7B58 ¶ added in v0.0.3
AesCBCDePKCS7B58 解密, Pkcs7Padding
func AesCBCDePKCS7B64 ¶
AesCBCDePKCS7B64 解密, Pkcs7Padding
func AesCBCDePKCS7Hex ¶
AesCBCDePKCS7Hex 解密, Pkcs7Padding
func AesCBCDePKCS7StringB58 ¶ added in v0.0.3
AesCBCDePKCS7StringB58 解密, Pkcs7Padding
func AesCBCDePKCS7StringB64 ¶
AesCBCDePKCS7StringB64 解密, Pkcs7Padding
func AesCBCDePKCS7StringHex ¶
AesCBCDePKCS7StringHex 解密, Pkcs7Padding
func AesCBCDeStringB58 ¶ added in v0.0.3
AesCBCDeStringB58 解密, ZerosPadding
func AesCBCDeStringB64 ¶
AesCBCDeStringB64 解密, ZerosPadding
func AesCBCDeStringHex ¶
AesCBCDeStringHex 解密, ZerosPadding
func AesCBCDecrypt ¶
AesCBCDecrypt AES-CBC 解密
func AesCBCDecryptE ¶ added in v0.0.3
AesCBCDecryptE AES-CBC 解密, 密码分组链接模式 (Cipher Block Chaining (CBC))
func AesCBCEnB58 ¶ added in v0.0.3
AesCBCEnB58 加密, ZerosPadding
func AesCBCEnPKCS7B58 ¶ added in v0.0.3
AesCBCEnPKCS7B58 加密, Pkcs7Padding
func AesCBCEnPKCS7B64 ¶
AesCBCEnPKCS7B64 加密, Pkcs7Padding
func AesCBCEnPKCS7Hex ¶
AesCBCEnPKCS7Hex 加密, Pkcs7Padding
func AesCBCEnPKCS7StringB58 ¶ added in v0.0.3
AesCBCEnPKCS7StringB58 加密, Pkcs7Padding
func AesCBCEnPKCS7StringB64 ¶
AesCBCEnPKCS7StringB64 加密, Pkcs7Padding
func AesCBCEnPKCS7StringHex ¶
AesCBCEnPKCS7StringHex 加密, Pkcs7Padding
func AesCBCEnStringB58 ¶ added in v0.0.3
AesCBCEnStringB58 加密, ZerosPadding
func AesCBCEnStringB64 ¶
AesCBCEnStringB64 加密, ZerosPadding
func AesCBCEnStringHex ¶
AesCBCEnStringHex 加密, ZerosPadding
func AesCBCEncrypt ¶
AesCBCEncrypt AES-CBC 加密
func AesCBCEncryptE ¶ added in v0.0.3
AesCBCEncryptE AES-CBC 加密, 密码分组链接模式 (Cipher Block Chaining (CBC)) key 长度分别是 16 (AES-128), 24 (AES-192?), 32 (AES-256?) asPKCS7: false (ZerosPadding), true (Pkcs7Padding)
func AesGCMDeB58 ¶ added in v0.0.3
AesGCMDeB58 解密
func AesGCMDeB64 ¶ added in v0.0.3
AesGCMDeB64 解密
func AesGCMDeHex ¶ added in v0.0.3
AesGCMDeHex 解密
func AesGCMDeStringB58 ¶ added in v0.0.3
AesGCMDeStringB58 解密
func AesGCMDeStringB64 ¶ added in v0.0.3
AesGCMDeStringB64 解密
func AesGCMDeStringHex ¶ added in v0.0.3
AesGCMDeStringHex 解密
func AesGCMDecrypt ¶ added in v0.0.3
AesGCMDecrypt AES-GCM 解密
func AesGCMDecryptWithNonce ¶ added in v0.0.3
AesGCMDecryptWithNonce AES-GCM 解密, (Galois/Counter Mode (GCM))
func AesGCMEnStringB58 ¶ added in v0.0.3
AesGCMEnStringB58 加密
func AesGCMEnStringB64 ¶ added in v0.0.3
AesGCMEnStringB64 加密
func AesGCMEnStringHex ¶ added in v0.0.3
AesGCMEnStringHex 加密
func AesGCMEncrypt ¶ added in v0.0.3
AesGCMEncrypt AES-GCM 加密
func AesGCMEncryptWithNonce ¶ added in v0.0.3
AesGCMEncryptWithNonce AES-GCM 加密, (Galois/Counter Mode (GCM)) key 长度分别是 16 (AES-128), 32 (AES-256)
func AssertEqual ¶
AssertEqual checks if values are equal Ref: gofiber/utils
func B64UrlEncode ¶
B64UrlEncode Base64 解码, 安全 URL, 替换: "+/" 为 "-_"
func CallPath ¶
func CallPath() string
CallPath 运行时路径, 编译目录 假如: mklink E:\tmp\linkapp.exe D:\Fufu\Test\abc\app.exe 执行: E:\tmp\linkapp.exe CallPath: E:\Go\src\github.com\fufuok\utils\tmp\osext
func Comma ¶ added in v0.1.3
Comma 整数转千分位分隔字符串 Ref: dustin/go-humanize e.g. Comma(834142) -> 834,142
func Commaf ¶ added in v0.1.3
Commaf 浮点数转千分位分隔字符串 Ref: dustin/go-humanize e.g. Commaf(834142.32) -> 834,142.32
func CopyString ¶
CopyString Immutable, string to string e.g. fiberParam := utils.CopyString(c.Params("test")) e.g. utils.CopyString(s[500:1000]) // 可以让 s 被 GC 回收
func DesCBCDeB58 ¶ added in v0.0.3
DesCBCDeB58 解密, ZerosPadding
func DesCBCDePKCS7B58 ¶ added in v0.0.3
DesCBCDePKCS7B58 解密, Pkcs7Padding
func DesCBCDePKCS7B64 ¶
DesCBCDePKCS7B64 解密, Pkcs7Padding
func DesCBCDePKCS7Hex ¶
DesCBCDePKCS7Hex 解密, Pkcs7Padding
func DesCBCDePKCS7StringB58 ¶ added in v0.0.3
DesCBCDePKCS7StringB58 解密, Pkcs7Padding
func DesCBCDePKCS7StringB64 ¶
DesCBCDePKCS7StringB64 解密, Pkcs7Padding
func DesCBCDePKCS7StringHex ¶
DesCBCDePKCS7StringHex 解密, Pkcs7Padding
func DesCBCDeStringB58 ¶ added in v0.0.3
DesCBCDeStringB58 解密, ZerosPadding
func DesCBCDeStringB64 ¶
DesCBCDeStringB64 解密, ZerosPadding
func DesCBCDeStringHex ¶
DesCBCDeStringHex 解密, ZerosPadding
func DesCBCDecrypt ¶
DesCBCDecrypt AES-CBC 解密
func DesCBCDecryptE ¶ added in v0.0.3
DesCBCDecryptE DES-CBC 解密, 密码分组链接模式 (Cipher Block Chaining (CBC))
func DesCBCEnB58 ¶ added in v0.0.3
DesCBCEnB58 加密, ZerosPadding
func DesCBCEnPKCS7B58 ¶ added in v0.0.3
DesCBCEnPKCS7B58 加密, Pkcs7Padding
func DesCBCEnPKCS7B64 ¶
DesCBCEnPKCS7B64 加密, Pkcs7Padding
func DesCBCEnPKCS7Hex ¶
DesCBCEnPKCS7Hex 加密, Pkcs7Padding
func DesCBCEnPKCS7StringB58 ¶ added in v0.0.3
DesCBCEnPKCS7StringB58 加密, Pkcs7Padding
func DesCBCEnPKCS7StringB64 ¶
DesCBCEnPKCS7StringB64 加密, Pkcs7Padding
func DesCBCEnPKCS7StringHex ¶
DesCBCEnPKCS7StringHex 加密, Pkcs7Padding
func DesCBCEnStringB58 ¶ added in v0.0.3
DesCBCEnStringB58 加密, ZerosPadding
func DesCBCEnStringB64 ¶
DesCBCEnStringB64 加密, ZerosPadding
func DesCBCEnStringHex ¶
DesCBCEnStringHex 加密, ZerosPadding
func DesCBCEncrypt ¶
DesCBCEncrypt AES-CBC 加密
func DesCBCEncryptE ¶ added in v0.0.3
DesCBCEncryptE DES-CBC 加密, 密码分组链接模式 (Cipher Block Chaining (CBC)) key 长度固定为 8 asPKCS7: false (ZerosPadding), true (Pkcs7Padding)
func Executable ¶ added in v0.1.2
Executable 当前执行程序绝对路径 true 时返回解析符号链接后的绝对路径 Excutable: E:\tmp\linkapp.exe Excutable(true): D:\Fufu\Test\abc\app.exe
func ExecutableDir ¶ added in v0.1.2
ExecutableDir 当前执行程序所在目录 true 时返回解析符号链接后的目录 ExcutableDir: E:\tmp ExcutableDir(true): D:\Fufu\Test\abc
func GenRSAKey ¶ added in v0.1.10
GenRSAKey 生成 RSA 密钥对 openssl genrsa -out rsa_private_key.pem 1024 openssl rsa -in rsa_private_key.pem -pubout -out rsa_public_key.pem
func Get0LastMonth ¶ added in v0.1.5
Get0LastMonth 上月第一天 0 点
func Get0NextMonth ¶ added in v0.1.5
Get0NextMonth 下月第一天 0 点
func GetNotInternalIPv4 ¶ added in v0.1.5
GetNotInternalIPv4 如果是内网 IPv4 则使用默认值, flag 为真是必定返回一个 IP
func GetNotInternalIPv4String ¶ added in v0.1.5
GetNotInternalIPv4String 如果是内网 IPv4 则使用默认值
func GetSafeB2S ¶ added in v0.1.1
GetSafeB2S Immutable, 可选指定默认值
func GetSafeBytes ¶ added in v0.1.1
GetSafeBytes Immutable, 可选指定默认值
func GetSafeS2B ¶ added in v0.1.1
GetSafeS2B Immutable, 可选指定默认值
func GetSafeString ¶ added in v0.1.1
GetSafeString Immutable, 可选指定默认值
func GetenvDecrypt ¶
GetenvDecrypt 解密环境变量参数(string)
func HmacSHA1Hex ¶
func HmacSHA256 ¶
func HmacSHA256Hex ¶
func HmacSHA512 ¶
func HmacSHA512Hex ¶
func HumanBaseBytes ¶ added in v0.1.3
HumanBaseBytes 数字的数量级表示
func HumanBytes ¶ added in v0.1.3
HumanBytes 数字的数量级表示 e.g. HumanBytes(82854982) -> 83 MB
func HumanIBytes ¶ added in v0.1.3
HumanIBytes 数字的数量级表示 e.g. HumanIBytes(82854982) -> 79 MiB
func IPv4String2Long ¶ added in v0.1.5
IPv4String2Long IPv4 字符串转数值
func IsInternalIPv4 ¶ added in v0.1.5
IsInternalIPv4 是否为内网 IPv4, 包含 NAT 专用网段 RFC6598, 比如华为云 ELB 的 100.125.0.0/16
func IsInternalIPv4String ¶ added in v0.1.5
IsInternalIPv4String 是否为内网 IPv4
func IsNil ¶ added in v0.1.8
func IsNil(i interface{}) bool
IsNil 判断对象(pointer, channel, func, interface, map, slice)是否为 nil nil 是一个 Type 类型的变量, Type 类型是基于 int 的类型 var 若变量本身是指针, 占用 8 字节, 指向类型内部结构体并置 0, 仅定义了变量本身, 此时为 nil
指针是非复合类型, 赋值 nil 时, 将 8 字节置 0, 即没有指向任何值的指针 0x0 map, channel: var 时仅定义了指针, 需要 make 初始化内部结构后才能使用, make 后非 nil
var 若变量非指针, 如 struct, int, 非 nil slice:
type slice struct, 占用 24 字节, 1 指针(array unsafe.Pointer) 2 个整型字段(len, cap int) var 定义后即可使用, 置 0 并分配, 此时 array 指针为 0 即没有实际数据时为 nil
interface:
type iface struct(interface 类型), type eface struct(空接口), 占用 16 字节 判断 data 指针为 0 即为 nil, 初始化后即非 0
func Long2IPv4String ¶ added in v0.1.5
Long2IPv4String 数值转 IPv4 字符串
func MustJSONIndent ¶ added in v0.1.7
func MustJSONIndent(v interface{}) []byte
MustJSONIndent 转 Jsoniter 返回 []byte
func MustJSONIndentString ¶ added in v0.1.7
func MustJSONIndentString(v interface{}) string
MustJSONIndentString 转 Jsoniter Indent 返回 string
func ParseHumanBytes ¶ added in v0.1.3
ParseHumanBytes 解析数字的数量级表示 e.g. ParseBytes("42 MB") -> 42000000, nil e.g. ParseBytes("42 mib") -> 44040192, nil
func ParsePrivateKey ¶ added in v0.1.10
func ParsePrivateKey(privateKey []byte) (priv *rsa.PrivateKey, err error)
ParsePrivateKey parses an RSA private key in PKCS #1, ASN.1 DER form.
func ParsePublicKey ¶ added in v0.1.10
ParsePublicKey parses a public key in PKIX, ASN.1 DER form.
func RSADecrypt ¶ added in v0.1.10
RSADecrypt 私钥解密
func RSAEncrypt ¶ added in v0.1.10
RSAEncrypt 公钥加密
func RSASignVerify ¶ added in v0.1.10
RSASignVerify 公钥验证签名
func Round ¶
Round 四舍五入, ROUND_HALF_UP 模式实现 返回将 val 根据指定精度 precision (十进制小数点后数字的数目) 进行四舍五入的结果 precision 也可以是负数或零 Ref: thinkeridea/go-extend
func SetenvEncrypt ¶
SetenvEncrypt 加密并设置环境变量(string)
func StrToBytes ¶ added in v0.1.3
StrToBytes Ref: Allenxuxu / toolkit
func String2Bytes ¶ added in v0.0.3
String2Bytes Ref: fasthttp
func StringToBytes ¶ added in v0.0.3
StringToBytes Ref: csdn.u010853261
func WeightedChoiceIndex ¶ added in v0.0.3
WeightedChoiceIndex 加权随机, 返回选中项的下标, -1 未选中任何项
func WeightedChoiceMap ¶ added in v0.0.3
func WeightedChoiceMap(choices map[interface{}]int) interface{}
WeightedChoiceMap 加权随机, map[object]weight
func WeightedChoiceWeightsIndex ¶ added in v0.0.3
WeightedChoiceWeightsIndex 加权随机, 参数为权重值列表, 返回选中项的下标, -1 未选中任何项
func XORDeStringB58 ¶ added in v0.1.10
XORDeStringB58 解密
func XORDeStringB64 ¶ added in v0.1.10
XORDeStringB64 解密
func XORDeStringHex ¶ added in v0.1.10
XORDeStringHex 解密
func XOREnStringB58 ¶ added in v0.1.10
XOREnStringB58 加密
func XOREnStringB64 ¶ added in v0.1.10
XOREnStringB64 加密
func XOREnStringHex ¶ added in v0.1.10
XOREnStringHex 加密
Types ¶
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package base58 provides an API for working with modified base58 and Base58Check encodings.
|
Package base58 provides an API for working with modified base58 and Base58Check encodings. |
环境变量加密工具 go run main.go -d=Fufu go run main.go -d="Fufu 777" go run main.go -d=Fufu -k=TestEnv go run main.go -k=TestEnv
|
环境变量加密工具 go run main.go -d=Fufu go run main.go -d="Fufu 777" go run main.go -d=Fufu -k=TestEnv go run main.go -k=TestEnv |
Package xid is a globally unique id generator suited for web scale Xid is using Mongo Object ID algorithm to generate globally unique ids: https://docs.mongodb.org/manual/reference/object-id/ - 4-byte value representing the seconds since the Unix epoch, - 3-byte machine identifier, - 2-byte process id, and - 3-byte counter, starting with a random value.
|
Package xid is a globally unique id generator suited for web scale Xid is using Mongo Object ID algorithm to generate globally unique ids: https://docs.mongodb.org/manual/reference/object-id/ - 4-byte value representing the seconds since the Unix epoch, - 3-byte machine identifier, - 2-byte process id, and - 3-byte counter, starting with a random value. |