util

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

*

*

*

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AESDecrypt added in v0.0.25

func AESDecrypt(key []byte, ciphertext []byte) ([]byte, bool)

Decrypt from base64 to decrypted string

func AESEncrypt added in v0.0.25

func AESEncrypt(key []byte, plaintext []byte) ([]byte, bool)

对称加密 AES 高级标准加密 Encrypt string to base64 crypto using AES

func Base64Decode

func Base64Decode(s string) ([]byte, error)

Base64解码

func Base64Encode

func Base64Encode(data []byte) string

Base64编码

func Base64URLDecode

func Base64URLDecode(s string) ([]byte, error)

Base64URL解码

func Base64URLEncode

func Base64URLEncode(data []byte) string

Base64URL编码

func GenRsaKey

func GenRsaKey(bits int) (e error, priKey string, pubKey string)

RSA256 公钥密钥对生成 @params: bits 密钥长度 @returns: private 密钥 @returns: public 公钥

func Md5Encode

func Md5Encode(str string) string

获取md5

func RsaDecrypt

func RsaDecrypt(ciphertext, privateKey []byte) ([]byte, error)

Rsa256 解密 @params: ciphertext 加密数据 @Params: prvKey 私钥

func RsaDecryptSimple

func RsaDecryptSimple(ciphertext, privateKey string) (string, error)

Rsa256 解密简单

func RsaEncrypt

func RsaEncrypt(origData, pubKey []byte) ([]byte, error)

Rsa256 加密 @params: origData 原始数据 @Params: pubKey 公钥

func RsaEncryptSimple

func RsaEncryptSimple(origData, pubKey string) (string, error)

Rsa256 加密简单 @params: origData 原始数据 @Params: pubKey 公钥

func RsaSign

func RsaSign(data, prvKey []byte) ([]byte, error)

Rsa256 签名 @params: origData 需要签名的数据 @Params: prvKey 私钥

func RsaSignSimple

func RsaSignSimple(data, prvKey string) (string, error)

Rsa256 签名简单 @params: origData 需要签名的数据 @Params: prvKey 私钥

func RsaSignVer

func RsaSignVer(data, signature, publicKey []byte) error

Rsa256 验签 @params: data 原始数据 @params: signature 签名 @params: publicKey 公钥

func RsaSignVerSimple

func RsaSignVerSimple(data, signature, publicKey string) error

Rsa256 验签简单 @params: data 原始数据 @params: signature 签名 @params: publicKey 公钥

func Sha1Encode

func Sha1Encode(str string) string

获取sha1

func Sha256Encode

func Sha256Encode(str string) string

获取sha256

func SuperRand

func SuperRand() string

Types

type StrZip

type StrZip struct {
}

func (*StrZip) Unzip

func (s *StrZip) Unzip(str string) string

func (*StrZip) Zip

func (s *StrZip) Zip(str string) string

Jump to

Keyboard shortcuts

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