mirror of
https://github.com/warmbly/warmbly.git
synced 2026-08-18 16:01:18 +00:00
21 lines
448 B
Go
21 lines
448 B
Go
package crypt
|
|
|
|
import (
|
|
"regexp"
|
|
)
|
|
|
|
var uuidRegex = regexp.MustCompile(`^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$`)
|
|
|
|
func IsValidUUID(u string) bool {
|
|
return uuidRegex.MatchString(u)
|
|
}
|
|
|
|
func IsValidHexColor(s string) bool {
|
|
return regexp.MustCompile(`^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$`).MatchString(s)
|
|
}
|
|
|
|
func ValidatePassword(password string) bool {
|
|
n := len([]rune(password))
|
|
return n >= 8 && n <= 128
|
|
}
|