mirror of
https://github.com/photoprism/photoprism.git
synced 2026-07-18 00:59:38 +00:00
16 lines
389 B
Go
16 lines
389 B
Go
package security
|
|
|
|
import "hash/fnv"
|
|
|
|
// HashPath returns a lightweight, deterministic hash for an HTTP request path.
|
|
func HashPath(path string) uint64 {
|
|
h := fnv.New64a()
|
|
_, _ = h.Write([]byte(path))
|
|
return h.Sum64()
|
|
}
|
|
|
|
// IsScanPath returns true if the request path matches a scanner path hash.
|
|
func IsScanPath(path string) bool {
|
|
_, ok := ScanPathHashes[HashPath(path)]
|
|
return ok
|
|
}
|