gocrypto

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: Apache-2.0 Imports: 21 Imported by: 5

Documentation

Overview

aes.go

des.go

padding.go

rsa.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesCBCDecrypt

func AesCBCDecrypt(ciphertext []byte, paddingType ...string) (plaintext []byte,
	err error)

func AesCBCEncrypt

func AesCBCEncrypt(plaintext []byte, paddingType ...string) (ciphertext []byte,
	err error)

func AesCFBDecrypt

func AesCFBDecrypt(ciphertext []byte, paddingType ...string) (plaintext []byte,
	err error)

func AesCFBEncrypt

func AesCFBEncrypt(plaintext []byte, paddingType ...string) (ciphertext []byte,
	err error)

func AesECBDecrypt

func AesECBDecrypt(ciphertext []byte, paddingType ...string) (plaintext []byte, err error)

func AesECBEncrypt

func AesECBEncrypt(plaintext []byte, paddingType ...string) (ciphertext []byte, err error)

func Crypto added in v1.6.1

func Crypto(ctype string, s string) (string, error)

func DesCBCDecrypt

func DesCBCDecrypt(ciphertext []byte, paddingType ...string) (plaintext []byte,
	err error)

func DesCBCEncrypt

func DesCBCEncrypt(plaintext []byte, paddingType ...string) (ciphertext []byte,
	err error)

func DesCFBDecrypt

func DesCFBDecrypt(ciphertext []byte, paddingType ...string) (plaintext []byte,
	err error)

func DesCFBEncrypt

func DesCFBEncrypt(plaintext []byte, paddingType ...string) (ciphertext []byte,
	err error)

func GenRsaKey

func GenRsaKey(bits int, pemFile ...string) error

openssl genrsa -out private.pem 1024 openssl rsa -in private.pem -pubout -out public.pem

func Hmac

func Hmac(ctype, s, key string) (string, error)

func HmacSha1 added in v1.6.1

func HmacSha1(ctype, s, key string) string

func HmacSha256 added in v1.6.1

func HmacSha256(ctype, s, key string) string

func Md5

func Md5(s string) string

func NewECBDecrypter

func NewECBDecrypter(b cipher.Block) cipher.BlockMode

NewECBDecrypter returns a BlockMode which decrypts in electronic code book mode, using the given Block.

func NewECBEncrypter

func NewECBEncrypter(b cipher.Block) cipher.BlockMode

NewECBEncrypter returns a BlockMode which encrypts in electronic code book mode, using the given Block.

func PKCS5Padding

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

func PKCS5UnPadding

func PKCS5UnPadding(origData []byte) []byte

func RSADecrypt

func RSADecrypt(data []byte, privatePem ...string) ([]byte, error)

func RSAEncrypt

func RSAEncrypt(data []byte, publicPem ...string) ([]byte, error)

func SetAesKey

func SetAesKey(key string) (err error)

func SetDesKey

func SetDesKey(key string) error

func Sha1

func Sha1(s string) string

func Sha256

func Sha256(s string) string

func Sha512

func Sha512(s string) string

func TripleDesCBCDecrypt

func TripleDesCBCDecrypt(ciphertext []byte, paddingType ...string) (plaintext []byte,
	err error)

3DES解密

func TripleDesCBCEncrypt

func TripleDesCBCEncrypt(plaintext []byte, paddingType ...string) (ciphertext []byte,
	err error)

3DES加密

func TripleDesCFBDecrypt

func TripleDesCFBDecrypt(ciphertext []byte, paddingType ...string) (plaintext []byte,
	err error)

3DES解密

func TripleDesCFBEncrypt

func TripleDesCFBEncrypt(plaintext []byte, paddingType ...string) (ciphertext []byte,
	err error)

3DES加密

func ZeroPadding

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

func ZeroUnPadding

func ZeroUnPadding(origData []byte) []byte

Types

This section is empty.

Jump to

Keyboard shortcuts

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