File tree 1 file changed +7
-7
lines changed
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -18,21 +18,21 @@ const (
18
18
)
19
19
20
20
var (
21
- noSuchHashFunction = fmt .Errorf ("no such hash function" )
21
+ errNoSuchHashFunction = fmt .Errorf ("no such hash function" )
22
22
)
23
23
24
24
func ApplyHashFunction (inp []byte , hf HashFunctionType ) ([]byte , error ) {
25
25
switch hf {
26
26
case HashFunctionIdent :
27
27
return inp , nil
28
28
case HashFunctionMurmur :
29
- h := murmur3 .Sum64 (inp )
30
- return []byte (strconv .FormatUint (h , 10 )), nil
29
+ h := murmur3 .Sum32 (inp )
30
+ return []byte (strconv .FormatUint (uint64 ( h ) , 10 )), nil
31
31
case HashFunctionCity :
32
- h := city .Hash64 (inp )
33
- return []byte (strconv .FormatUint (h , 10 )), nil
32
+ h := city .Hash32 (inp )
33
+ return []byte (strconv .FormatUint (uint64 ( h ) , 10 )), nil
34
34
default :
35
- return nil , noSuchHashFunction
35
+ return nil , errNoSuchHashFunction
36
36
}
37
37
}
38
38
@@ -45,6 +45,6 @@ func HashFunctionByName(hfn string) (HashFunctionType, error) {
45
45
case "city" :
46
46
return HashFunctionCity , nil
47
47
default :
48
- return 0 , noSuchHashFunction
48
+ return 0 , errNoSuchHashFunction
49
49
}
50
50
}
You can’t perform that action at this time.
0 commit comments