diff --git a/context.go b/context.go index 8260391..cf1ab08 100644 --- a/context.go +++ b/context.go @@ -5,6 +5,8 @@ import ( "fmt" "errors" "runtime" + "crypto/sha512" + "encoding/binary" ) type NodeType string @@ -13,12 +15,6 @@ func (node NodeType) Hash() uint64 { 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 func (ext ExtType) Hash() uint64 { hash := sha512.Sum512([]byte(fmt.Sprintf("EXTENSION: %s", string(ext)))) diff --git a/node.go b/node.go index 3a7d741..4d9a0d0 100644 --- a/node.go +++ b/node.go @@ -9,7 +9,6 @@ import ( "fmt" "encoding/binary" "encoding/json" - "crypto/sha512" "sync/atomic" ) diff --git a/policy.go b/policy.go index b2c5b80..3d3d544 100644 --- a/policy.go +++ b/policy.go @@ -3,6 +3,8 @@ package graphvent import ( "encoding/json" "fmt" + "crypto/sha512" + "encoding/binary" ) type PolicyType string