utils

package
v0.0.0-...-3779236 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GOBDecodedBytes

func GOBDecodedBytes(data []byte, val interface{}) error

func GOBEncodedBytes

func GOBEncodedBytes(val interface{}) (*bytes.Buffer, error)

func GetRandBytes

func GetRandBytes(n int, alphabet ...byte) []byte

func GetRandSecret

func GetRandSecret(n int, alphabet ...byte) (string, error)

func GetRandSecretBytes

func GetRandSecretBytes(n int, alphabet ...byte) ([]byte, error)

GetRandSecretBytes generate random string from a set of alphabet. This function uses CSPRNG (crypto-grade random generator) to generate a random value.

func GetRandString

func GetRandString(n int, alphabet ...byte) string

func HashString

func HashString(str, salt string) string

func MD5

func MD5(str string) string

MD5 encodes a string to a MD5 encoded string.

func MD5Bytes

func MD5Bytes(str string) []byte

MD5Bytes encodes a string to MD5 bytes.

func SHA1

func SHA1(str string) string

SHA1 encodes a string to a 40-byte long SHA1 encoded string.

func SHA1Bytes

func SHA1Bytes(str string) []byte

SHA1Bytes encodes a string to SHA1 bytes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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