Files
2026-02-14 05:38:27 +01:00

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
}