util

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtoInt64

func AtoInt64(num string) int64

func CreateFile

func CreateFile(filePath string) error

调用os.MkdirAll递归创建文件夹

func EncodeMD5

func EncodeMD5(value string) string

func Exists

func Exists(path string) bool

判断所给路径文件/文件夹是否存在

func GenRsaKey

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

RSA公钥私钥产生

func IsDir

func IsDir(path string) bool

判断所给路径是否为文件夹

func IsFile

func IsFile(path string) bool

判断所给路径是否为文件

func Md5V1

func Md5V1(str string) string

MD5算法

func RandIntn

func RandIntn(n int) int

func RsaDecrypt

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

私钥解密

func RsaEncrypt

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

公钥加密

func RsaSignWithSha256

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

签名

func RsaVerySignWithSha256

func RsaVerySignWithSha256(data, signData, keyBytes []byte) bool

验证

func StringIn

func StringIn(target string, container ...string) bool

func TimeHash

func TimeHash() string

基于md5生成一个随机字符串

func Today

func Today() time.Time

Types

type RsaLength

type RsaLength int
const (
	LEN_1024 RsaLength = 1024
	LEN_2048 RsaLength = 2048
)

Jump to

Keyboard shortcuts

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