|
|
@ -5,6 +5,8 @@ import (
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"errors"
|
|
|
|
"errors"
|
|
|
|
"runtime"
|
|
|
|
"runtime"
|
|
|
|
|
|
|
|
"crypto/sha512"
|
|
|
|
|
|
|
|
"encoding/binary"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type NodeType string
|
|
|
|
type NodeType string
|
|
|
@ -13,12 +15,6 @@ func (node NodeType) Hash() uint64 {
|
|
|
|
return binary.BigEndian.Uint64(hash[(len(hash)-9):(len(hash)-1)])
|
|
|
|
return binary.BigEndian.Uint64(hash[(len(hash)-9):(len(hash)-1)])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type PolicyType string
|
|
|
|
|
|
|
|
func (policy PolicyType) Hash() uint64 {
|
|
|
|
|
|
|
|
hash := sha512.Sum512([]byte(fmt.Sprintf("POLICY: %s", string(policy))))
|
|
|
|
|
|
|
|
return binary.BigEndian.Uint64(hash[(len(hash)-9):(len(hash)-1)])
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type ExtType string
|
|
|
|
type ExtType string
|
|
|
|
func (ext ExtType) Hash() uint64 {
|
|
|
|
func (ext ExtType) Hash() uint64 {
|
|
|
|
hash := sha512.Sum512([]byte(fmt.Sprintf("EXTENSION: %s", string(ext))))
|
|
|
|
hash := sha512.Sum512([]byte(fmt.Sprintf("EXTENSION: %s", string(ext))))
|
|
|
|