Documentation ¶
Index ¶
- Constants
- func BasicAuthDecode(encoded string) (string, string, error)
- func BasicAuthEncode(username, password string) string
- func CreateTimeLimitCode(data string, minutes int, startInf interface{}) string
- func FileSize(s int64) string
- func MD5(str string) string
- func MD5Bytes(str string) []byte
- func RandomString(n int) (string, error)
- func SHA1(str string) string
- func ShortSHA1(sha1 string) string
- func TimeSincePro(then time.Time) string
- func VerifyTimeLimitCode(data string, minutes int, code string) bool
Constants ¶
View Source
const ( Byte = 1 KByte = Byte * 1024 MByte = KByte * 1024 GByte = MByte * 1024 TByte = GByte * 1024 PByte = TByte * 1024 EByte = PByte * 1024 )
const for bytes sizes
View Source
const ( Minute = 60 Hour = 60 * Minute Day = 24 * Hour Week = 7 * Day Month = 30 * Day Year = 12 * Month )
Seconds-based time units
View Source
const TimeLimitCodeLength = 12 + 6 + 40
TimeLimitCodeLength for Time Verification
Variables ¶
This section is empty.
Functions ¶
func BasicAuthDecode ¶
BasicAuthDecode decodes username and password portions of HTTP Basic Authentication from encoded content.
func BasicAuthEncode ¶
BasicAuthEncode encodes username and password in HTTP Basic Authentication format.
func CreateTimeLimitCode ¶
CreateTimeLimitCode create a time limit code code format: 12 length date time string + 6 minutes string + 40 sha1 encoded string
func RandomString ¶
RandomString returns generated random string in given length of characters. It also returns possible error during generation.
func TimeSincePro ¶
TimeSincePro calculates the time interval and generate full user-friendly string.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.