Documentation ¶
Overview ¶
Package crypt provides utilities for creating hashes, random strings, password encryption
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // AlphaUpper all upper alphas chars AlphaUpper = RandomSource("ABCDEFGHIJKLMNOPQRSTUVWXYZ") // AlphaLower all lowers alphas chars AlphaLower = RandomSource("abcdefghijklmnopqrstuvwxyz") // AlphaUpperLower all upper and lowers aplhas chars AlphaUpperLower = RandomSource("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") // AlphaUpperLowerNumeric all upper lowers alphas and numerics AlphaUpperLowerNumeric = RandomSource("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz") // AlphaUpperLowerNumericSpecial all upper lowers alphas, numerics and special chars AlphaUpperLowerNumericSpecial = RandomSource("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456890" + "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~") )
Functions ¶
func CryptPassword ¶
CryptPassword hashes a password with bcrypt and a given cost
func GenerateSalt ¶
func GenerateSalt() []byte
GenerateSalt generates a random salt with alphanumerics and some special characters
func RandomSecureKey ¶
RandomSecureKey returns random character with given length
Types ¶
type RandomSource ¶
type RandomSource string
RandomSource string containing which characters should be considered when generating random sequences
func (RandomSource) RandomSequence ¶
func (r RandomSource) RandomSequence(length int) []byte
RandomSequence returns random character with given length;
Click to show internal directories.
Click to hide internal directories.