encrypt

package
v0.0.0-...-790eabe Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: MulanPSL-2.0 Imports: 10 Imported by: 0

README

encrypt

加解密和哈希算法合集。

  • SHA1
  • HmacSHA1
  • MD5
  • AES/CBC/PKCS5
  • AES/ECB/PKCS7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesCbcPkcs5Decrypt

func AesCbcPkcs5Decrypt(cipherData string, keyStr string) (plainText string, err error)

AES/CBC/PKCS5模式解密

func AesCbcPkcs5Encrypt

func AesCbcPkcs5Encrypt(originData string, keyStr string) (encryptText string, err error)

AES/CBC/PKCS5模式加密

func AesEbcPkcs7Encrypt

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

AES/ECB/PKCS7模式加密

func HmacSHA1

func HmacSHA1(plainText string, key string) string

func MD5

func MD5(plainText string) string

func NewECBDecrypter

func NewECBDecrypter(b cipher.Block) cipher.BlockMode

func NewECBEncrypter

func NewECBEncrypter(b cipher.Block) cipher.BlockMode

func PKCSPadding

func PKCSPadding(plainText []byte, blockSize int) []byte

PKCS填充(PKCS5和PKCS7的算法一样,只是填充字段多少的区别)

func PKCSUnPadding

func PKCSUnPadding(cipherText []byte) []byte

PKCS反填充(PKCS5和PKCS7的算法一样,只是填充字段多少的区别)

func SHA1

func SHA1(plainText string) string

Types

type ECB

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

ECB算法实现

func NewECB

func NewECB(b cipher.Block) *ECB

type EcbDecrypter

type EcbDecrypter ECB

ECB解密部分

func (*EcbDecrypter) BlockSize

func (x *EcbDecrypter) BlockSize() int

func (*EcbDecrypter) CryptBlocks

func (x *EcbDecrypter) CryptBlocks(dst, src []byte)

type EcbEncrypter

type EcbEncrypter ECB

ECB加密部分

func (*EcbEncrypter) BlockSize

func (x *EcbEncrypter) BlockSize() int

func (*EcbEncrypter) CryptBlocks

func (x *EcbEncrypter) CryptBlocks(dst, src []byte)

Jump to

Keyboard shortcuts

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