加密aes类

package
v0.0.0-...-2910145 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

包gaes提供了AES加密/解密算法的有用API。

Index

Constants

View Source
const (
	// IVDefaultValue 是 IV 的默认值。
	IVDefaultValue = "I Love Go Frame!"
)

Variables

This section is empty.

Functions

func Decrypt别名

func Decrypt别名(cipherText []byte, key []byte, iv ...[]byte) ([]byte, error)

Decrypt 是 DecryptCBC 的别名。

func Encrypt别名

func Encrypt别名(plainText []byte, key []byte, iv ...[]byte) ([]byte, error)

Encrypt 是 EncryptCBC 的别名。

func PKCS5Padding

func PKCS5Padding(src []byte, blockSize ...int) []byte

PKCS5Padding 对源字节切片应用PKCS#5填充,以匹配给定的块大小。

若未提供块大小,则默认为8。

func PKCS5UnPadding

func PKCS5UnPadding(src []byte, blockSize ...int) ([]byte, error)

PKCS5UnPadding 根据给定的块大小,从源字节切片中移除PKCS#5填充。

若未提供块大小,则默认为8。

func PKCS7Padding

func PKCS7Padding(src []byte, blockSize int) []byte

PKCS7Padding 对源字节切片应用PKCS#7填充,以匹配给定的块大小。

func PKCS7UnPadding

func PKCS7UnPadding(src []byte, blockSize int) ([]byte, error)

PKCS7UnPadding 根据给定的块大小,从源字节切片中移除PKCS#7填充。

func X加密CBC

func X加密CBC(待加密 []byte, 秘钥 []byte, iv ...[]byte) ([]byte, error)

EncryptCBC 使用CBC模式加密`plainText`。 注意,密钥必须为16/24/32位长度。 参数`iv`(初始化向量)是不必要的。

func X加密CFB

func X加密CFB(待加密 []byte, 秘钥 []byte, padding *int, iv ...[]byte) ([]byte, error)

EncryptCFB 使用CFB模式加密`plainText`。 注意,密钥必须为16/24/32比特长度。 参数`iv`(初始化向量)不是必需的。

func X解密CBC

func X解密CBC(待解密 []byte, 秘钥 []byte, iv ...[]byte) ([]byte, error)

DecryptCBC 使用CBC模式解密`cipherText`。 注意,密钥必须为16/24/32比特长度。 参数`iv`初始化向量是不必要的。

func X解密CFB

func X解密CFB(待解密 []byte, 秘钥 []byte, unPadding int, iv ...[]byte) ([]byte, error)

DecryptCFB 使用CFB模式解密`plainText`。 注意,密钥必须为16/24/32位长度。 参数`iv`初始化向量是不必要的。

func ZeroPadding

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

func ZeroUnPadding

func ZeroUnPadding(plaintext []byte, unPadding int) []byte

Types

This section is empty.

Jump to

Keyboard shortcuts

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