aesutil

package
v2.0.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package aesutil provides aes encryption and decryption.

Index

Constants

View Source
const (
	Aes128 = 16
	Aes192 = 24
	Aes256 = 32
)

Variables

This section is empty.

Functions

func AdjustKey

func AdjustKey(key []byte) (cipher.Block, error)

AdjustKey 获取对自适应长度秘钥

func CbcDecrypt

func CbcDecrypt(cipherText, key, iv []byte) (plaintext []byte, err error)

func CbcEncrypt

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

CbcEncrypt aes cbc encrypt, refer to https://pkg.go.dev/crypto/cipher@latest#example-NewCBCDecrypter

func CfbDecrypt

func CfbDecrypt(cipherText, key, iv []byte) (plaintext []byte, err error)

func CfbEncrypt

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

func CtrDecrypt

func CtrDecrypt(cipherText, key, iv []byte) (plaintext []byte, err error)

func CtrEncrypt

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

func GcmDecrypt

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

func GcmEncrypt

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

func OfbDecrypt

func OfbDecrypt(cipherText, key, iv []byte) (plaintext []byte, err error)

func OfbEncrypt

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

func Pkcs7Padding

func Pkcs7Padding(data []byte, blockSize int) ([]byte, error)

func Pkcs7UnPadding

func Pkcs7UnPadding(data []byte, blockSize int) ([]byte, error)

func ZeroPadding

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

func ZeroUnPadding

func ZeroUnPadding(data []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