crypto

package
v0.0.0-...-9496d56 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesCBCDecrypt

func AesCBCDecrypt(cipherText []byte, key []byte, iv []byte, padding CryptoPadding) ([]byte, error)

func AesCBCEncrypt

func AesCBCEncrypt(plainText []byte, key []byte, iv []byte, padding CryptoPadding) ([]byte, error)

func XorCrypto

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

Types

type AesCBC

type AesCBC struct {
	// contains filtered or unexported fields
}

func NewAesCBCPKCS5

func NewAesCBCPKCS5() *AesCBC

func NewAesCBCPKCS7

func NewAesCBCPKCS7() *AesCBC

func (*AesCBC) Decrypt

func (crypto *AesCBC) Decrypt(cipherText []byte, key []byte, iv []byte) ([]byte, error)

func (*AesCBC) Encrypt

func (crypto *AesCBC) Encrypt(plainText []byte, key []byte, iv []byte) ([]byte, error)

type CryptoPadding

type CryptoPadding interface {
	Padding(plainText []byte, blockSize int) []byte
	UnPadding(cipherText []byte) ([]byte, error)
}

type PKCS5Padding

type PKCS5Padding struct{}

func (*PKCS5Padding) Padding

func (p *PKCS5Padding) Padding(plainText []byte, blockSize int) []byte

func (*PKCS5Padding) UnPadding

func (p *PKCS5Padding) UnPadding(cipherText []byte) ([]byte, error)

type PKCS7Padding

type PKCS7Padding struct{}

func (*PKCS7Padding) Padding

func (p *PKCS7Padding) Padding(plainText []byte, blockSize int) []byte

func (*PKCS7Padding) UnPadding

func (p *PKCS7Padding) UnPadding(cipherText []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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