utils

package
v0.0.0-...-6562851 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckMenu

func CheckMenu(pageType int, path string) string

func CheckPassword

func CheckPassword(password string) (b bool)

CheckPassword 验证密码

func CheckUsername

func CheckUsername(username string) (b bool)

CheckUsername 验证名称 必须是、下划线、@、.和6-10位之间的字母

func DecryptWithRSA

func DecryptWithRSA(cipherText string, privateKeyPath string) (string, error)

DecryptWithRSA rsa解密

func Difference

func Difference(slice1, slice2 []int) []int

Difference 求差集 slice1-并集

func EncryptWithRSA

func EncryptWithRSA(plainText string, publicKeyPath string) (string, error)

EncryptWithRSA rsa加密

func EncryptWithSha256

func EncryptWithSha256(data string) string

EncryptWithSha256 sha256加密

func GenRandomString

func GenRandomString(n int, code int) string

GenRandomString 生成随机字符串或数字验证码,n表示要生成的字符串长度,code表示类型,1 数字验证码,2 随机字符串 https://colobu.com/2018/09/02/generate-random-string-in-Go/

func GenerateFeatureLabel

func GenerateFeatureLabel(url string) string

func GenerateRSAKey

func GenerateRSAKey(bits int) error

GenerateRSAKey 生成私钥和公钥, bits参数指定证书大小 也可以直接通过openssl命令生成: 私钥:openssl genrsa -out rsa_private_key.pem 2048 公钥:openssl rsa -in rsa_private_key.pem -pubout -out rsa_public_key.pem

func Intersect

func Intersect(slice1, slice2 []int) []int

Intersect 求交集

func StructToJson

func StructToJson(Struct interface{}) (string, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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