MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / CheckHash

Function CheckHash

internal/utils/bfs/hash.go:13–25  ·  view source on GitHub ↗

CheckHash check hash string format

(hash string)

Source from the content-addressed store, hash-verified

11
12// CheckHash check hash string format
13func CheckHash(hash string) bool {
14 if len(hash) != HashLen {
15 return false
16 }
17
18 for _, b := range hash {
19 if !((b >= '0' && b <= '9') || (b >= 'a' && b <= 'f')) {
20 return false
21 }
22 }
23
24 return true
25}
26
27func CheckHashErr(hash string) error {
28 if CheckHash(hash) {

Callers 3

TestCheckHashFunction · 0.92
BenchmarkCheckHashErrFunction · 0.92
CheckHashErrFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestCheckHashFunction · 0.74
BenchmarkCheckHashErrFunction · 0.74