enc

package
v0.0.0-...-4873089 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: Apache-2.0 Imports: 22 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64

func Base64(source string) string

Base64 安全编码, URL兼容,并且去除后面多余的等号。

func Base64Decode

func Base64Decode(src string) (string, error)

Base64Decode 安全解码,兼容标准和URL编码,以及后面去除等号的情况。

func Base64SafeDecode

func Base64SafeDecode(source string) ([]byte, error)

Base64SafeDecode 安全解码,兼容标准和URL编码,以及后面等号是否多余

func Base64SafeEncode

func Base64SafeEncode(source []byte) string

Base64SafeEncode 安全URL编码,去除后面多余的等号

func CBCDecrypt

func CBCDecrypt(strKey, strCiphertext string) (string, error)

CBCDecrypt ...

func CBCEncrypt

func CBCEncrypt(strKey, strPlaintext string) (string, error)

CBCEncrypt encrypt original with key of either 16, 24, or 32 bytes

func Checksum

func Checksum(data []byte) string

Checksum 返回data的校验和

func FixStrLength

func FixStrLength(s string, fixLen int) string

FixStrLength ...

func HmacSha1

func HmacSha1(src string, key string) string

HmacSha1 generate HmacSha1 of src in BASE64 format

func JSON

func JSON(v interface{}) string

JSON 序列化v到JSON串

func JSONCompact

func JSONCompact(data interface{}) string

JSONCompact compact the JSON encoding of data silently

func JSONCompactE

func JSONCompactE(data interface{}) (string, error)

JSONCompactE compact the JSON encoding of data

func JSONPretty

func JSONPretty(data interface{}) string

JSONPretty prettify the JSON encoding of data silently

func JSONPrettyE

func JSONPrettyE(data interface{}) (string, error)

JSONPrettyE prettify the JSON encoding of data

func PKCS5Padding

func PKCS5Padding(ciphertext []byte, blockSize int) []byte

PKCS5Padding ...

func PKCS5UnPadding

func PKCS5UnPadding(origData []byte) []byte

PKCS5UnPadding ...

func Sha256

func Sha256(src string) (string, error)

Sha256 generate a sha256 hash of src in HEX format

func Targz

func Targz(srcPath string, baseDir bool, writer io.Writer) error

Targz takes a source path (srcPath) and writer and walks 'srcPath' writing each file found to the tar writer; the purpose for accepting multiple writers is to allow for multiple outputs (for example a file, or md5 hash) https://medium.com/@skdomino/taring-untaring-files-in-go-6b07cf56bc07

func TomlToJSON

func TomlToJSON(data []byte) ([]byte, error)

TomlToJSON ...

func Untargz

func Untargz(dst string, r io.Reader) error

Untargz takes a destination path and a reader; a tar reader loops over the tarfile creating the file structure at 'dst' along the way, and writing any files

func ZeroPadding

func ZeroPadding(ciphertext []byte, blockSize int) []byte

ZeroPadding ...

Types

This section is empty.

Jump to

Keyboard shortcuts

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