crypto

package
v0.0.0-...-e41513e Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: Apache-2.0 Imports: 17 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcMd5File

func CalcMd5File(filename string) (string, error)

TODO(@benqi): remove to baselib

func GenerateNonce

func GenerateNonce(size int) []byte

func GenerateStringNonce

func GenerateStringNonce(size int) string

func Sha1Digest

func Sha1Digest(data []byte) []byte

func Sha256Digest

func Sha256Digest(data []byte) []byte

Types

type AES256IGECryptor

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

func NewAES256IGECryptor

func NewAES256IGECryptor(aesKey, aesIV []byte) *AES256IGECryptor

func (*AES256IGECryptor) Decrypt

func (c *AES256IGECryptor) Decrypt(data []byte) ([]byte, error)

func (*AES256IGECryptor) Encrypt

func (c *AES256IGECryptor) Encrypt(data []byte) ([]byte, error)

data长度必须是aes.BlockSize(16)的倍数,如果不是请调用者补齐

type AesCTR128Encrypt

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

func NewAesCTR128Encrypt

func NewAesCTR128Encrypt(key []byte, iv []byte) (*AesCTR128Encrypt, error)

key长度必须为16、24或32

func (*AesCTR128Encrypt) Encrypt

func (this *AesCTR128Encrypt) Encrypt(plaintext []byte) []byte

type AesCTR128KeySizeError

type AesCTR128KeySizeError int

func (AesCTR128KeySizeError) Error

func (k AesCTR128KeySizeError) Error() string

type RSACryptor

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

bca2c43964f3b7d1e7dfff4a769fd174770487399df315de2d2a47208cda5d32c90f0f01849cb58d1fe2a9e1bc25ee72aed55a6ea312900ea5b48a60ca51fffff1688ccb17d411eee043d8397420074a8e8ba92bd3c8976481fdfe238f40e583b0bf8bb7c8031b4c41cbeb0f7bfd991ddcca3235fa3bd078b0eb318c5ae4e6a0e8583ae2a09a2b009ede1407cfa4e05fdb0ef7a215ee752ac913495b43ca4258da4c63c701f62f2bf96062b5cbe8b8b0c0be6b674d7eda921a03ce62a0a49058962018e2a03bdefeeee5421ea44f10815d2308e8712423ee6cff1d83efcf94b2d52b2c54e4276242d663d84332e2cf7194d2b35fc5decc4d0c1c46ba6d0a6717

func NewRSACryptor

func NewRSACryptor() *RSACryptor

TODO(@benqi): 这里写死了pkcs1PemPrivateKey

func (*RSACryptor) Decrypt

func (m *RSACryptor) Decrypt(b []byte) []byte

func (*RSACryptor) Encrypt

func (m *RSACryptor) Encrypt(b []byte) []byte

Jump to

Keyboard shortcuts

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