From 299999d4f2a413707c04c7ed8fb8d64a60c3c2c6 Mon Sep 17 00:00:00 2001 From: Vu Quoc Huy Date: Sat, 24 Jun 2017 16:04:02 +0700 Subject: [PATCH] Fix import name --- crypto/hasher/hasher.go | 4 ++-- merkletree/node.go | 8 ++++---- merkletree/pad.go | 4 ++-- merkletree/proof.go | 10 +++++----- merkletree/str.go | 4 ++-- protocol/policy.go | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/crypto/hasher/hasher.go b/crypto/hasher/hasher.go index 57baf5e..e33534f 100644 --- a/crypto/hasher/hasher.go +++ b/crypto/hasher/hasher.go @@ -39,7 +39,7 @@ var hashers = make(map[string]PADHasher) // RegisterHasher registers a hasher for use. func RegisterHasher(h string, f func() PADHasher) { if _, ok := hashers[h]; ok { - panic(fmt.Sprintf("RegisterHasher(%v) is already registered", h)) + panic(fmt.Sprintf("%s is already registered", h)) } hashers[h] = f() } @@ -49,5 +49,5 @@ func Hasher(h string) (PADHasher, error) { if f, ok := hashers[h]; ok { return f, nil } - return nil, fmt.Errorf("Hasher(%v) is unknown hasher", h) + return nil, fmt.Errorf("%s is an unknown hasher", h) } diff --git a/merkletree/node.go b/merkletree/node.go index 9893882..7665ad8 100644 --- a/merkletree/node.go +++ b/merkletree/node.go @@ -2,7 +2,7 @@ package merkletree import ( "github.com/coniks-sys/coniks-go/crypto" - conikshasher "github.com/coniks-sys/coniks-go/crypto/hasher/coniks" + chasher "github.com/coniks-sys/coniks-go/crypto/hasher/coniks" "github.com/coniks-sys/coniks-go/utils" ) @@ -83,11 +83,11 @@ func (n *interiorNode) hash(m *MerkleTree) []byte { if n.rightHash == nil { n.rightHash = n.rightChild.hash(m) } - return conikshasher.New().HashInterior(n.leftHash, n.rightHash) + return chasher.New().HashInterior(n.leftHash, n.rightHash) } func (n *userLeafNode) hash(m *MerkleTree) []byte { - return conikshasher.New().HashLeaf( + return chasher.New().HashLeaf( m.nonce, n.index, n.level, @@ -96,7 +96,7 @@ func (n *userLeafNode) hash(m *MerkleTree) []byte { } func (n *emptyNode) hash(m *MerkleTree) []byte { - return conikshasher.New().HashEmpty( + return chasher.New().HashEmpty( m.nonce, n.index, n.level, diff --git a/merkletree/pad.go b/merkletree/pad.go index 18a06a7..cbbe912 100644 --- a/merkletree/pad.go +++ b/merkletree/pad.go @@ -5,7 +5,7 @@ import ( "errors" "github.com/coniks-sys/coniks-go/crypto" - conikshasher "github.com/coniks-sys/coniks-go/crypto/hasher/coniks" + chasher "github.com/coniks-sys/coniks-go/crypto/hasher/coniks" "github.com/coniks-sys/coniks-go/crypto/sign" "github.com/coniks-sys/coniks-go/crypto/vrf" ) @@ -64,7 +64,7 @@ func (pad *PAD) signTreeRoot(epoch uint64) { panic(err) } } else { - prevHash = conikshasher.New().Digest(pad.latestSTR.Signature) + prevHash = chasher.New().Digest(pad.latestSTR.Signature) } pad.tree.recomputeHash() m := pad.tree.Clone() diff --git a/merkletree/proof.go b/merkletree/proof.go index ba137c5..f830d1e 100644 --- a/merkletree/proof.go +++ b/merkletree/proof.go @@ -6,7 +6,7 @@ import ( "github.com/coniks-sys/coniks-go/crypto" "github.com/coniks-sys/coniks-go/crypto/hasher" - conikshasher "github.com/coniks-sys/coniks-go/crypto/hasher/coniks" + chasher "github.com/coniks-sys/coniks-go/crypto/hasher/coniks" "github.com/coniks-sys/coniks-go/utils" ) @@ -41,13 +41,13 @@ type ProofNode struct { func (n *ProofNode) hash(treeNonce []byte) []byte { if n.IsEmpty { // empty leaf node - return conikshasher.New().HashEmpty( + return chasher.New().HashEmpty( treeNonce, n.Index, n.Level, ) } else { - return conikshasher.New().HashLeaf( + return chasher.New().HashLeaf( treeNonce, n.Index, n.Level, @@ -88,9 +88,9 @@ func (ap *AuthenticationPath) authPathHash() []byte { for depth > 0 { depth -= 1 if indexBits[depth] { // right child - hash = conikshasher.New().Digest(ap.PrunedTree[depth][:], hash) + hash = chasher.New().Digest(ap.PrunedTree[depth][:], hash) } else { - hash = conikshasher.New().Digest(hash, ap.PrunedTree[depth][:]) + hash = chasher.New().Digest(hash, ap.PrunedTree[depth][:]) } } return hash diff --git a/merkletree/str.go b/merkletree/str.go index 2ad3466..aa1be3f 100644 --- a/merkletree/str.go +++ b/merkletree/str.go @@ -3,7 +3,7 @@ package merkletree import ( "bytes" - conikshasher "github.com/coniks-sys/coniks-go/crypto/hasher/coniks" + chasher "github.com/coniks-sys/coniks-go/crypto/hasher/coniks" "github.com/coniks-sys/coniks-go/crypto/sign" "github.com/coniks-sys/coniks-go/utils" ) @@ -79,7 +79,7 @@ func (str *SignedTreeRoot) SerializeInternal() []byte { // in the issued STR. The hash chain is valid if // these two hash values are equal and consecutive. func (str *SignedTreeRoot) VerifyHashChain(savedSTR *SignedTreeRoot) bool { - hash := conikshasher.New().Digest(savedSTR.Signature) + hash := chasher.New().Digest(savedSTR.Signature) return str.PreviousEpoch == savedSTR.Epoch && str.Epoch == savedSTR.Epoch+1 && bytes.Equal(hash, str.PreviousSTRHash) diff --git a/protocol/policy.go b/protocol/policy.go index 409cae1..bac3d85 100644 --- a/protocol/policy.go +++ b/protocol/policy.go @@ -1,7 +1,7 @@ package protocol import ( - conikshasher "github.com/coniks-sys/coniks-go/crypto/hasher/coniks" + chasher "github.com/coniks-sys/coniks-go/crypto/hasher/coniks" "github.com/coniks-sys/coniks-go/crypto/vrf" "github.com/coniks-sys/coniks-go/merkletree" "github.com/coniks-sys/coniks-go/utils" @@ -29,7 +29,7 @@ var _ merkletree.AssocData = (*Policies)(nil) func NewPolicies(epDeadline Timestamp, vrfPublicKey vrf.PublicKey) *Policies { return &Policies{ Version: Version, - HashID: conikshasher.New().ID(), + HashID: chasher.New().ID(), VrfPublicKey: vrfPublicKey, EpochDeadline: epDeadline, }