Cleanups, move Hash() to id.go

This commit is contained in:
Alexander Neumann
2016-01-26 21:49:33 +01:00
parent b482df04ec
commit da883d6196
2 changed files with 17 additions and 28 deletions
+7 -5
View File
@@ -2,13 +2,19 @@ package backend
import (
"bytes"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"errors"
)
// Hash returns the ID for data.
func Hash(data []byte) ID {
return sha256.Sum256(data)
}
// IDSize contains the size of an ID, in bytes.
const IDSize = hashSize
const IDSize = sha256.Size
// ID references content within a repository.
type ID [IDSize]byte
@@ -98,7 +104,3 @@ func (id *ID) UnmarshalJSON(b []byte) error {
return nil
}
func IDFromData(d []byte) ID {
return hashData(d)
}