fix: close remaining security remediation gaps

This commit is contained in:
sagitchu
2026-05-14 11:10:06 +08:00
parent f0facf6703
commit abf13bdac9
5 changed files with 182 additions and 23 deletions
+14
View File
@@ -23,3 +23,17 @@ func VerifyPassword(storedHash, plain string) (bool, bool) {
}
return false, false
}
func IsLegacyPasswordHash(storedHash string) bool {
storedHash = strings.TrimSpace(storedHash)
if len(storedHash) != 32 {
return false
}
for _, r := range storedHash {
if (r >= '0' && r <= '9') || (r >= 'a' && r <= 'f') || (r >= 'A' && r <= 'F') {
continue
}
return false
}
return true
}