加密DES类

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: 5 Imported by: 0

Documentation

Overview

Package gdes 提供了用于DES加密/解密算法的有用API。

Index

Constants

View Source
const (
	NOPADDING = iota
	PKCS5PADDING
)

Variables

This section is empty.

Functions

func Padding

func Padding(text []byte, padding int) ([]byte, error)

func PaddingPKCS5

func PaddingPKCS5(text []byte, blockSize int) []byte

func UnPadding

func UnPadding(text []byte, padding int) ([]byte, error)

func UnPaddingPKCS5

func UnPaddingPKCS5(text []byte) []byte

func X加密CBC

func X加密CBC(待加密 []byte, 密钥 []byte, iv []byte, 填充 int) ([]byte, error)

EncryptCBC 使用CBC模式加密`plainText`。

func X加密ECB

func X加密ECB(待加密 []byte, 秘钥 []byte, 填充 int) ([]byte, error)

EncryptECB 使用ECB模式加密`plainText`。

func X加密三重CBC

func X加密三重CBC(待加密 []byte, 密钥 []byte, iv []byte, 填充 int) ([]byte, error)

EncryptCBCTriple 使用TripleDES算法和CBC模式加密`plainText`。

func X加密三重ECB

func X加密三重ECB(待加密 []byte, 秘钥 []byte, 填充 int) ([]byte, error)

EncryptECBTriple 使用TripleDES加密算法及ECB模式加密`plainText`。 `key`的长度应为16字节或24字节。

func X解密CBC

func X解密CBC(待解密 []byte, 密钥 []byte, iv []byte, 填充 int) ([]byte, error)

DecryptCBC 使用CBC模式解密`cipherText`。

func X解密ECB

func X解密ECB(待解密 []byte, 秘钥 []byte, 填充 int) ([]byte, error)

DecryptECB 使用ECB模式解密`cipherText`。

func X解密三重CBC

func X解密三重CBC(待解密 []byte, 密钥 []byte, iv []byte, 填充 int) ([]byte, error)

DecryptCBCTriple 使用3DES加密算法和CBC模式解密`cipherText`。

func X解密三重ECB

func X解密三重ECB(待解密 []byte, 秘钥 []byte, 填充 int) ([]byte, error)

DecryptECBTriple 使用TripleDES和ECB模式解密`cipherText`。 `key`的长度应为16字节或24字节。

Types

This section is empty.

Jump to

Keyboard shortcuts

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