Skip to content

Commit

Permalink
Unexport HashLogRoot
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbelvin committed Mar 6, 2018
1 parent 955e85d commit cc99c97
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions crypto/data_formats.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ const (
mapKeyTreeSize string = "TreeSize"
)

// HashLogRoot hashes SignedLogRoot objects using ObjectHash with
// hashLogRoot hashes SignedLogRoot objects using ObjectHash with
// "RootHash", "TimestampNanos", and "TreeSize", used as keys in
// a map.
func HashLogRoot(root trillian.SignedLogRoot) ([]byte, error) {
func hashLogRoot(root trillian.SignedLogRoot) ([]byte, error) {
// Pull out the fields we want to hash.
// Caution: use string format for int64 values as they can overflow when
// JSON encoded otherwise (it uses floats). We want to be sure that people
Expand Down
4 changes: 2 additions & 2 deletions crypto/data_formats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestHashLogRootKnownValue(t *testing.T) {
RootHash: []byte("Some bytes that won't change"),
TreeSize: 167329345,
}
hash, err := HashLogRoot(root)
hash, err := hashLogRoot(root)
if err != nil {
t.Fatalf("HashLogRoot(): %v", err)
}
Expand Down Expand Up @@ -75,7 +75,7 @@ func TestHashLogRoot(t *testing.T) {
},
},
} {
hash, err := HashLogRoot(test.root)
hash, err := hashLogRoot(test.root)
if err != nil {
t.Fatalf("HashLogRoot(): %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion crypto/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (s *Signer) SignObject(obj interface{}) (*sigpb.DigitallySigned, error) {

// SignLogRoot hashes and signs the supplied (to-be) SignedLogRoot and returns a SignedLogRoot
func (s *Signer) SignLogRoot(root *trillian.SignedLogRoot) (*trillian.SignedLogRoot, error) {
hash, err := HashLogRoot(*root)
hash, err := hashLogRoot(*root)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion crypto/signer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func TestSignWithSignedLogRoot_SignerFails(t *testing.T) {

s := testonly.NewSignerWithErr(key, errors.New("signfail"))
root := trillian.SignedLogRoot{TimestampNanos: 2267709, RootHash: []byte("Islington"), TreeSize: 2}
hash, err := HashLogRoot(root)
hash, err := hashLogRoot(root)
if err != nil {
t.Fatalf("HashLogRoot(): %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion crypto/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var (
// VerifySignedLogRoot verifies the SignedLogRoot and returns its contents.
func VerifySignedLogRoot(pub crypto.PublicKey, r *trillian.SignedLogRoot) (*trillian.SignedLogRoot, error) {
// Verify SignedLogRoot signature.
hash, err := HashLogRoot(*r)
hash, err := hashLogRoot(*r)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit cc99c97

Please sign in to comment.