aesKit

package
v1.30.12 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package aesKit

更多可以参考:https://github.com/hwholiday/learning_tools/blob/master/encryption_algorithm/aes.go

Package aesKit

AES/ECB/PKCS5Padding 参考:https://www.cnblogs.com/lavin/p/5373188.html 缺点:代码中有 panic 秘钥:长度必须是 16、24、32 中的一个!

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(cipherText, key []byte) (plainText []byte, err error)

func DecryptToString

func DecryptToString(base64Text, key []byte) (string, error)

func Encrypt

func Encrypt(plainText, key []byte) (cipherText []byte, err error)

func EncryptToString

func EncryptToString(plainText, key []byte) (string, error)

EncryptToString 加密流程: 明文 => 密文 => base64字符串

@param plainText 可以为""

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 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