crypto

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AESDecryptByECB

func AESDecryptByECB(text, key string) string

func AESEncryptByECB

func AESEncryptByECB(text, key string) string

AESEncryptByECB golang和Java中的AES模式不一样:java aes默认加密模式为ECB golang 默认的是CBC模式

func AesECBDecrypt added in v1.0.4

func AesECBDecrypt(crypted, key []byte) (origData []byte, err error)

func AesECBEncrypt added in v1.0.4

func AesECBEncrypt(src, key []byte) (crypted []byte, err error)

func EcbDecrypt

func EcbDecrypt(data, key []byte) []byte

func EcbEncrypt

func EcbEncrypt(data, key []byte) []byte

func GcmDecrypt added in v1.0.4

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

GcmDecrypt decrypts data using 128-bit AES-GCM. This both hides the content of the data and provides a check that it hasn't been altered. Expects input form nonce|ciphertext|tag where '|' indicates concatenation.

func GcmEncrypt added in v1.0.4

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

GcmEncrypt encrypts data using 128-bit AES-GCM. This both hides the content of the data and provides a check that it hasn't been altered. Output takes the form nonce|ciphertext|tag where '|' indicates concatenation.

func Get16BitMD5

func Get16BitMD5(noSign string) string

func HmacSha256

func HmacSha256(message string, secret string) string

HmacSha256

func MD5

func MD5(noSign string) string

MD5

func NewECBDecrypter added in v1.0.4

func NewECBDecrypter(b cipher.Block) cipher.BlockMode

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

func NewECBEncrypter added in v1.0.4

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

PKCS5Padding

func PKCS5UnPadding added in v1.0.4

func PKCS5UnPadding(origData []byte) []byte

func PKCS5Unpadding

func PKCS5Unpadding(origData []byte) []byte

func Sha256Sign

func Sha256Sign(noSign string) string

Sha256Sign

Types

This section is empty.

Jump to

Keyboard shortcuts

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