util

package
v1.0.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package ecb implements block cipher mode of encryption ECB (Electronic Code Book) functions. This is implemented for legacy purposes only and should not be used for any new encryption needs. Use CBC (Cipher Block Chaining) instead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AESECBPKCS7Decrypt

func AESECBPKCS7Decrypt(cipherData, key []byte) (decrypted []byte, err error)

AES decryption with ECB and PKCS7 padding

AES算法有AES-128、AES-192、AES-256三种,分别对应的key是 16、24、32字节长度

对应的加密解密区块长度BlockSize也是16、24、32字节长度

func AESECBPKCS7Encrypt

func AESECBPKCS7Encrypt(pt, key []byte) (encrypted []byte, err error)

AES encryption with ECB and PKCS7 padding

AES算法有AES-128、AES-192、AES-256三种,分别对应的key是 16、24、32字节长度

对应的加密解密区块长度BlockSize也是16、24、32字节长度

func GetRandString

func GetRandString(length int) string

GetRandString 获取指定长度的随机字符串

func GetRandStringWithCharset

func GetRandStringWithCharset(length int, charset string) string

GetRandStringWithCharset 获取指定字符集 下 指定长度的随机字符串

func Map2XML

func Map2XML(kvs map[string]string) (text []byte, err error)

func NewECBDecrypter

func NewECBDecrypter(b cipher.Block) cipher.BlockMode

NewECBDecrypter returns a BlockMode which decrypts in electronic codebook (ECB) mode, using the given Block.

func NewECBEncrypter

func NewECBEncrypter(b cipher.Block) cipher.BlockMode

NewECBEncrypter returns a BlockMode which encrypts in elecronic codebook (ECB) mode, using the given Block (Cipher).

func StructToMapByXMLTag

func StructToMapByXMLTag(item interface{}, result map[string]interface{})

func XML2Map

func XML2Map(text []byte) (result map[string]string, err error)

Types

type CDATA

type CDATA string

func (CDATA) MarshalXML

func (c CDATA) MarshalXML(e *xml.Encoder, start xml.StartElement) error

Jump to

Keyboard shortcuts

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