Documentation ¶
Index ¶
- Constants
- func AppendBytes(s ...[]byte) []byte
- func AppendString(s ...string) string
- func CreateURLSafeSlug(input string, suffix int) string
- func CryptPassword(password []byte, cost int) ([]byte, error)
- func DecodeBase64(b64 string) (string, error)
- func EncodeBase64(input string) string
- func GenerateSalt() []byte
- func IsOneOfStringsEmpty(s ...string) bool
- func RandomHash(length int) string
- func RandomSecureKey(length int) []byte
- func SanitizeFilename(s string) string
- func TrimmedStringIsEmpty(s string) bool
- type RandomSource
Constants ¶
const ( //AlphaUpper all upper alphas chars AlphaUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" //AlphaLower all lowers alphas chars AlphaLower = "abcdefghijklmnopqrstuvwxyz" //AlphaUpperLower all upper and lowers aplhas chars AlphaUpperLower = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" //AlphaUpperLowerNumeric all upper lowers alphas and numerics AlphaUpperLowerNumeric = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz" //AlphaUpperLowerNumericSpecial all upper lowers alphas, numerics and special chas AlphaUpperLowerNumericSpecial = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456890" + "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~" )
Variables ¶
This section is empty.
Functions ¶
func AppendBytes ¶
AppendBytes uses byte buffer to append multiple byte arrays
func AppendString ¶
AppendString uses byte buffer to append multiple strings
func CreateURLSafeSlug ¶
CreateURLSafeSlug creates a url safe slug to use in urls
func CryptPassword ¶
CryptPassword bcrypts a password at given costs
func DecodeBase64 ¶
DecodeBase64 descodes a string to base64
func GenerateSalt ¶
func GenerateSalt() []byte
GenerateSalt generates a random salt with alphanumerics and some special characters
func IsOneOfStringsEmpty ¶
IsOneOfStringsEmpty checks if one of the given strings is empty
func RandomSecureKey ¶
RandomSecureKey returns random character with given length
func SanitizeFilename ¶
SanitizeFilename sanitizes a filename for safe use when serving file
Types ¶
type RandomSource ¶
type RandomSource struct {
CharsToGen string
}
RandomSource express which chars should be considered
func (RandomSource) RandomSequence ¶
func (r RandomSource) RandomSequence(length int) []byte
RandomSequence returns random character with given length; random source express which chars should be considered