crypt

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesCFBDecrypt

func AesCFBDecrypt(base64str string, key []byte) ([]byte, error)

AesCFBDecrypt Aes解密

func AesCFBEncrypt

func AesCFBEncrypt(msg, key []byte) (string, error)

AesCFBEncrypt Aes加密

func ChaChaDecrypt added in v0.1.0

func ChaChaDecrypt(password, ciphertext []byte) ([]byte, error)

ChaChaDecrypt 解密

func ChaChaEncrypt added in v0.1.0

func ChaChaEncrypt(password, plaintext []byte) ([]byte, error)

ChaChaEncrypt 加密

func HMacMD5

func HMacMD5(s string, key []byte) string

HMacMD5 生成hmac hash

func MD5

func MD5(s string) string

MD5 生成md5摘要

func Md5Stream

func Md5Stream(reader io.Reader) (string, error)

Md5Stream 流式处理

func Md5Sum

func Md5Sum(filename string) (string, error)

func RandAuthToken

func RandAuthToken() string

func RandNumber

func RandNumber(min, max int) int

RandNumber 生成min - max之间的随机数 如果min大于max, panic

func RandString

func RandString(length int64) string

RandString 生成长度为length的随机字符串

func SHA1

func SHA1(s string) string

SHA1 生成sha1摘要

func SHA1Stream

func SHA1Stream(reader io.Reader) (string, error)

SHA1Stream 流式处理

func SHA1StreamSum

func SHA1StreamSum(filename string) (string, error)

Types

type Rsa

type Rsa struct {
	// contains filtered or unexported fields
}

func NewRsa

func NewRsa(publicKeyReader io.Reader, privateKeyReader io.Reader) (*Rsa, error)

NewRsa 创建Rsa

func (*Rsa) Decrypt

func (r *Rsa) Decrypt(cipherText []byte) ([]byte, error)

Decrypt Rsa解密

func (*Rsa) Encrypt

func (r *Rsa) Encrypt(msg []byte) ([]byte, error)

RsaEncrypt Rsa加密

Jump to

Keyboard shortcuts

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