crypto

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2021 License: Apache-2.0 Imports: 18 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Aes128CBCDecrypt added in v0.0.2

func Aes128CBCDecrypt(key [16]byte, ciphertext []byte) (plaintext []byte, err error)

Aes128CBCDecrypt aes-128-cbc 解密

func Aes128CBCEncrypt added in v0.0.2

func Aes128CBCEncrypt(key [16]byte, plaintext []byte) (ciphertext []byte, err error)

Aes128CBCEncrypt aes-128-cbc 加密

func Aes128CFBDecrypt added in v0.0.2

func Aes128CFBDecrypt(key [16]byte, cipherReader io.Reader) (plainReader io.Reader, err error)

Aes128CFBDecrypt aes-128-cfb 解密

func Aes128CFBEncrypt added in v0.0.2

func Aes128CFBEncrypt(key [16]byte, plainReader io.Reader) (cipherReader io.Reader, err error)

Aes128CFBEncrypt aes-128-cfb 加密

func Aes128CTRDecrypt added in v0.0.2

func Aes128CTRDecrypt(key [16]byte, cipherReader io.Reader) (plainReader io.Reader, err error)

Aes128CTRDecrypt aes-128-ctr 解密

func Aes128CTREncrypt added in v0.0.2

func Aes128CTREncrypt(key [16]byte, plainReader io.Reader) (cipherReader io.Reader, err error)

Aes128CTREncrypt aes-128-ctr 加密

func Aes128ECBDecrypt added in v0.0.2

func Aes128ECBDecrypt(key [16]byte, ciphertext []byte) (plaintext []byte, err error)

Aes128ECBDecrypt aes-128-ecb 解密

func Aes128ECBEncrypt added in v0.0.2

func Aes128ECBEncrypt(key [16]byte, plaintext []byte) (ciphertext []byte, err error)

Aes128ECBEncrypt aes-128-ecb 加密

func Aes128OFBDecrypt added in v0.0.2

func Aes128OFBDecrypt(key [16]byte, cipherReader io.Reader) (plainReader io.Reader, err error)

Aes128OFBDecrypt aes-128-ofb 解密

func Aes128OFBEncrypt added in v0.0.2

func Aes128OFBEncrypt(key [16]byte, plainReader io.Reader) (cipherReader io.Reader, err error)

Aes128OFBEncrypt aes-128-ofb 加密

func Aes192CBCDecrypt added in v0.0.2

func Aes192CBCDecrypt(key [24]byte, ciphertext []byte) (plaintext []byte, err error)

Aes192CBCDecrypt aes-192-cbc 解密

func Aes192CBCEncrypt added in v0.0.2

func Aes192CBCEncrypt(key [24]byte, plaintext []byte) (ciphertext []byte, err error)

Aes192CBCEncrypt aes-192-cbc 加密

func Aes192CFBDecrypt added in v0.0.2

func Aes192CFBDecrypt(key [24]byte, cipherReader io.Reader) (plainReader io.Reader, err error)

Aes192CFBDecrypt aes-192-cfb 解密

func Aes192CFBEncrypt added in v0.0.2

func Aes192CFBEncrypt(key [24]byte, plainReader io.Reader) (cipherReader io.Reader, err error)

Aes192CFBEncrypt aes-192-cfb 加密

func Aes192CTRDecrypt added in v0.0.2

func Aes192CTRDecrypt(key [24]byte, cipherReader io.Reader) (plainReader io.Reader, err error)

Aes192CTRDecrypt aes-192-ctr 解密

func Aes192CTREncrypt added in v0.0.2

func Aes192CTREncrypt(key [24]byte, plainReader io.Reader) (cipherReader io.Reader, err error)

Aes192CTREncrypt aes-192-ctr 加密

func Aes192ECBDecrypt added in v0.0.2

func Aes192ECBDecrypt(key [24]byte, ciphertext []byte) (plaintext []byte, err error)

Aes192ECBDecrypt aes-192-ecb 解密

func Aes192ECBEncrypt added in v0.0.2

func Aes192ECBEncrypt(key [24]byte, plaintext []byte) (ciphertext []byte, err error)

Aes192ECBEncrypt aes-192-ecb 加密

func Aes192OFBDecrypt added in v0.0.2

func Aes192OFBDecrypt(key [24]byte, cipherReader io.Reader) (plainReader io.Reader, err error)

Aes192OFBDecrypt aes-192-ofb 解密

func Aes192OFBEncrypt added in v0.0.2

func Aes192OFBEncrypt(key [24]byte, plainReader io.Reader) (cipherReader io.Reader, err error)

Aes192OFBEncrypt aes-192-ofb 加密

func Aes256CBCDecrypt added in v0.0.2

func Aes256CBCDecrypt(key [32]byte, ciphertext []byte) (plaintext []byte, err error)

Aes256CBCDecrypt aes-256-cbc 解密

func Aes256CBCEncrypt added in v0.0.2

func Aes256CBCEncrypt(key [32]byte, plaintext []byte) (ciphertext []byte, err error)

Aes256CBCEncrypt aes-256-cbc 加密

func Aes256CFBDecrypt added in v0.0.2

func Aes256CFBDecrypt(key [32]byte, cipherReader io.Reader) (plainReader io.Reader, err error)

Aes256CFBDecrypt aes-256-cfb 解密

func Aes256CFBEncrypt added in v0.0.2

func Aes256CFBEncrypt(key [32]byte, plainReader io.Reader) (cipherReader io.Reader, err error)

Aes256CFBEncrypt aes-256-cfb 加密

func Aes256CTRDecrypt added in v0.0.2

func Aes256CTRDecrypt(key [32]byte, cipherReader io.Reader) (plainReader io.Reader, err error)

Aes256CTRDecrypt aes-256-ctr 解密

func Aes256CTREncrypt added in v0.0.2

func Aes256CTREncrypt(key [32]byte, plainReader io.Reader) (cipherReader io.Reader, err error)

Aes256CTREncrypt aes-256-ctr 加密

func Aes256ECBDecrypt added in v0.0.2

func Aes256ECBDecrypt(key [32]byte, ciphertext []byte) (plaintext []byte, err error)

Aes256ECBDecrypt aes-256-ecb 解密

func Aes256ECBEncrypt added in v0.0.2

func Aes256ECBEncrypt(key [32]byte, plaintext []byte) (ciphertext []byte, err error)

Aes256ECBEncrypt aes-256-ecb 加密

func Aes256OFBDecrypt added in v0.0.2

func Aes256OFBDecrypt(key [32]byte, cipherReader io.Reader) (plainReader io.Reader, err error)

Aes256OFBDecrypt aes-256-ofb 解密

func Aes256OFBEncrypt added in v0.0.2

func Aes256OFBEncrypt(key [32]byte, plainReader io.Reader) (cipherReader io.Reader, err error)

Aes256OFBEncrypt aes-256-ofb 加密

func Base64Decode

func Base64Decode(raw []byte) []byte

Base64Decode base64解密

func Base64DecodeStr

func Base64DecodeStr(bs64str string) string

Base64DecodeStr base64字符串解密

func Base64Encode

func Base64Encode(raw []byte) []byte

Base64Encode base64加密

func Base64EncodeStr

func Base64EncodeStr(raw string) string

Base64EncodeStr base64字符串加密

func Convert16bytes added in v0.0.2

func Convert16bytes(b []byte) (b16 [16]byte)

Convert16bytes 将 []byte 转为 [16]byte

func Convert24bytes added in v0.0.2

func Convert24bytes(b []byte) (b24 [24]byte)

Convert24bytes 将 []byte 转为 [24]byte

func Convert32bytes added in v0.0.2

func Convert32bytes(b []byte) (b32 [32]byte)

Convert32bytes 将 []byte 转为 [32]byte

func DecryptAES

func DecryptAES(src []byte, key []byte) ([]byte, error)

解密

func EncryptAES

func EncryptAES(src []byte, key []byte) ([]byte, error)

加密

func HmacMD5 added in v0.0.2

func HmacMD5(key, origData []byte) (sum []byte)

HmacMD5 HMAC-SHA512-签名认证

func HmacSHA1 added in v0.0.2

func HmacSHA1(key, origData []byte) (sum []byte)

HmacSHA1 HMAC-SHA-1签名认证

func HmacSHA256 added in v0.0.2

func HmacSHA256(key, origData []byte) (sum []byte)

HmacSHA256 HMAC-SHA-256签名认证

func HmacSHA512 added in v0.0.2

func HmacSHA512(key, origData []byte) (sum []byte)

HmacSHA512 HMAC-SHA-512签名认证

func PKCS5Padding added in v0.0.2

func PKCS5Padding(ciphertext []byte, blockSize int) []byte

PKCS5Padding PKCS5 Padding

func PKCS5UnPadding added in v0.0.2

func PKCS5UnPadding(plaintext []byte) []byte

PKCS5UnPadding PKCS5 UnPadding

func RsaDecrypt

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

解密

func RsaEncrypt

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

加密

Types

type AesMode added in v0.0.2

type AesMode int

AesMode AES 工作模式

const (
	// AesECB ecb 模式
	AesECB AesMode = iota
	// AesCBC cbc 模式
	AesCBC
	// AesCTR ctr 模式
	AesCTR
	// AesCFB cfb 模式
	AesCFB
	// AesOFB ofb 模式
	AesOFB
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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