stringhelper

package
v1.0.0-rc12 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareLabels

func CompareLabels(search map[string]string, labels map[string]string) bool

CompareLabels compares two maps of labels

func DoHashsMatchWithString

func DoHashsMatchWithString(hash, text string, salt []byte) bool

Check if two passwords match

func EscapeString added in v0.3.7

func EscapeString(str string) string

func GetMD5Hash deprecated

func GetMD5Hash(data []byte) string

Deprecated: Use GetSHA256Hash, GetSHA384Hash or GetSHA512Hash instead GetMD5Hash returns the md5 hash of a byte array WARNING: This function is not safe for hashing passwords

func GetSHA256Hash added in v0.3.5

func GetSHA256Hash(data []byte) string

GetSHA256Hash returns the SHA256 hash of a byte array

func GetSHA384Hash added in v0.3.5

func GetSHA384Hash(data []byte) string

GetSHA384Hash returns the SHA384 hash of a byte array

func GetSHA512Hash added in v0.3.5

func GetSHA512Hash(data []byte) string

GetSHA512Hash returns the SHA512 hash of a byte array

func HashSHA512

func HashSHA512(text string, salt []byte) string

Hash a password with the SHA-512 algorithm

func JsonToMap

func JsonToMap(jsonStr string) (map[string]interface{}, error)

JsonToMap converts a json string to a map

func PrettyprintStruct

func PrettyprintStruct(obj interface{})

PrettyprintStruct prints a struct in a pretty way

func RandomString

func RandomString(strSize int, randType StringType) string

RandomString returns a random string of the specified length

Types

type StringType

type StringType = string
const (
	StringTypeUnknown   StringType = "Unknown"
	StringTypeAlphaNum  StringType = "alphanum"
	StringTypeClusterId StringType = "clusterid"
	StringTypeAlpha     StringType = "alpha"
	StringTypeNumber    StringType = "number"
)

Jump to

Keyboard shortcuts

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