utilsCrypto

package
v0.0.0-...-7ec6a99 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const PADDING_MODE_PKCS5 = "PKCS5"
View Source
const PADDING_MODE_PKCS7 = "PKCS7"
View Source
const PADDING_MODE_ZEROS = "ZEROS"

Variables

This section is empty.

Functions

func AesDecrypt

func AesDecrypt(cipherData []byte, aesKey []byte) ([]byte, error)

标准AES解密

func AesEncrypt

func AesEncrypt(plainData []byte, aesKey []byte) ([]byte, error)

标准AES加密

func Base64DecodeB2S

func Base64DecodeB2S(src []byte) string

func Base64DecodeS2B

func Base64DecodeS2B(src string) (result []byte, err error)

func Base64DecodeS2S

func Base64DecodeS2S(src string) (string, error)

base64 标准解密

func Base64DecodeWithTable

func Base64DecodeWithTable(src []byte, base64table string) (dst []byte, err error)

base64 自定义码表解密返回byte

func Base64EncodeB2B

func Base64EncodeB2B(src []byte) (result []byte)

func Base64EncodeB2S

func Base64EncodeB2S(src []byte) string

func Base64EncodeS2B

func Base64EncodeS2B(src string) (result []byte)

func Base64EncodeS2S

func Base64EncodeS2S(src string) string

base64 标准加密返回字符

func DesDecrypt

func DesDecrypt(cipherData []byte, key []byte, vi []byte, padMode string) ([]byte, error)

func DesEncrypt

func DesEncrypt(plainData []byte, key []byte, vi []byte, padMode string) ([]byte, error)

func HashHex

func HashHex(hashBytes []byte) string

func HmacMd5

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

func HmacSha1

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

func HmacSha256

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

func Md5

func Md5(srcBytes []byte) []byte

MD5 计算

func Md5Hex

func Md5Hex(src string) string

func SHA1Default

func SHA1Default(s string) string

SHA1标准算法

Types

type PKCS5

type PKCS5 struct{}

func (*PKCS5) Pad

func (p *PKCS5) Pad(src []byte, blockSize int) []byte

func (*PKCS5) Unpad

func (p *PKCS5) Unpad(src []byte) []byte

type PKCS7

type PKCS7 struct{}

func (*PKCS7) Pad

func (p *PKCS7) Pad(src []byte, blockSize int) []byte

func (*PKCS7) Unpad

func (p *PKCS7) Unpad(src []byte) []byte

type PKCSZero

type PKCSZero struct{}

func (*PKCSZero) Pad

func (p *PKCSZero) Pad(src []byte, blockSize int) []byte

func (*PKCSZero) Unpad

func (p *PKCSZero) Unpad(src []byte) []byte

type Padding

type Padding interface {
	Pad(src []byte, blockSize int) []byte
	Unpad(src []byte) []byte
}

Jump to

Keyboard shortcuts

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