Skip to content

Commit

Permalink
Fix import name
Browse files Browse the repository at this point in the history
  • Loading branch information
vqhuy committed Jun 24, 2017
1 parent 29aa6a2 commit 299999d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions crypto/hasher/hasher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand All @@ -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)
}
8 changes: 4 additions & 4 deletions merkletree/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions merkletree/pad.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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()
Expand Down
10 changes: 5 additions & 5 deletions merkletree/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions merkletree/str.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions protocol/policy.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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,
}
Expand Down

0 comments on commit 299999d

Please sign in to comment.