aes

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package

Package

Index

Constants

View Source
const (
	AES_MODEL string = "OFF"
	AES_KEY16        = "3D334C30D5E6CEDD"
	AES_KEY24        = "E065323B9EA400D3C23E56D8"
	AES_KEY32        = "F9D8CEB63D334C30D5E6CEDDFCB942CE"
	ECB              = "ECB"
	CBC              = "CBC"
	CRT              = "CRT"
	OFB              = "OFB"
	RSA              = "RSA"
)
View Source
const MSG_PKG_MAX_LEN = 1024 * 8 * 2 //最大包长,8192

Variables

This section is empty.

Functions

func AESDecrypt

func AESDecrypt(src []byte) (decrypted []byte, e error)

func AESEncrypt

func AESEncrypt(src []byte) (encrypted []byte, e error)

func AES_CBC_Decrypt

func AES_CBC_Decrypt(src []byte, key []byte) (decrypted []byte, e error)

CBC 解密

func AES_CBC_Encrypt

func AES_CBC_Encrypt(src []byte, key []byte) (encrypted []byte, e error)

CBC 加密

func AES_ECB_Decrypt

func AES_ECB_Decrypt(encrypted []byte, key []byte) (decrypted []byte, e error)

解密

func AES_ECB_Encrypt

func AES_ECB_Encrypt(src []byte, key []byte) (encrypted []byte, e error)

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////电码本模式 ECB模式/////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 加密

func ECB_GenerateKey

func ECB_GenerateKey(key []byte) (newKey []byte)

产生Key

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 PKCS7Padding

func PKCS7Padding(ciphertext []byte, blocksize int) []byte

补码 AES加密数据块分组长度必须为128bit(byte[16]),密钥长度可以是128bit(byte[16])、192bit(byte[24])、256bit(byte[32])中的任意一个。

func PKCS7UnPadding

func PKCS7UnPadding(origData []byte) []byte

去码

Types

type AesEncrypt

type AesEncrypt struct {
	StrKey string
}

func NewAesEncrypt

func NewAesEncrypt(key string) (aes *AesEncrypt, err error)

func (*AesEncrypt) Decrypt

func (this *AesEncrypt) Decrypt(src []byte) (strDesc string, err error)

解密字符串

func (*AesEncrypt) Encrypt

func (this *AesEncrypt) Encrypt(strMesg string) ([]byte, error)

加密字符串

Jump to

Keyboard shortcuts

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