utils

package
v0.0.0-...-a32ce64 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2018 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeBase64

func DecodeBase64(s string) []byte

DecodeBase64 returns a decode base64 []byte from string.

func Decrypt

func Decrypt(block cipher.Block, key, value []byte) []byte

Decrypt returns an AES decrypted string.

func DecryptXOR

func DecryptXOR(key []byte, value string) []byte

DecryptXOR return a decrypted XORed string.

func EncodeBase64

func EncodeBase64(b []byte) string

EncodeBase64 returns an encoded base64 string from []byte.

func Encrypt

func Encrypt(block cipher.Block, key, text []byte) ([]byte, error)

Encrypt return an AES encrypted []byte.

func EncryptXOR

func EncryptXOR(key, value []byte) string

EncryptXOR return a XORed encrypted string.

func GobDecode

func GobDecode(data []byte, values *map[string]interface{}) error

GobDecode return a pointer of decoded gob []byte

func GobEncode

func GobEncode(data map[string]interface{}) ([]byte, error)

GobEncode return an encoded golang gob []byte

func RandomString

func RandomString(t string, l int) string

func StrPad

func StrPad(input string, padLength int, padString string, padType string) string

StrPad returns the input string padded on the left, right or both sides using padType to the specified padding length padLength.

Example: input := "Codes"; StrPad(input, 10, " ", "RIGHT") // produces "Codes " StrPad(input, 10, "-=", "LEFT") // produces "=-=-=Codes" StrPad(input, 10, "_", "BOTH") // produces "__Codes___" StrPad(input, 6, "___", "RIGHT") // produces "Codes_" StrPad(input, 3, "*", "RIGHT") // produces "Codes"

Types

This section is empty.

Jump to

Keyboard shortcuts

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