diff --git a/io_test.go b/io_test.go index d9ac4e5..7382194 100644 --- a/io_test.go +++ b/io_test.go @@ -21,7 +21,7 @@ func (er *evilReader) Read(buf []byte) (int, error) { } func TestEvilReader(t *testing.T) { - emptyHash, err := Sum(nil, ID, 0) + emptyHash, err := Sum(nil, IDENTITY, 0) if err != nil { t.Fatal(err) } diff --git a/multihash.go b/multihash.go index d3cad1b..ffb0944 100644 --- a/multihash.go +++ b/multihash.go @@ -36,7 +36,9 @@ func (e ErrInconsistentLen) Error() string { // constants const ( - ID = 0x00 + IDENTITY = 0x00 + // Deprecated: use IDENTITY + ID = IDENTITY SHA1 = 0x11 SHA2_256 = 0x12 SHA2_512 = 0x13 @@ -89,7 +91,7 @@ func init() { // Names maps the name of a hash to the code var Names = map[string]uint64{ - "identity": ID, + "identity": IDENTITY, "sha1": SHA1, "sha2-256": SHA2_256, "sha2-512": SHA2_512, @@ -112,7 +114,7 @@ var Names = map[string]uint64{ // Codes maps a hash code to it's name var Codes = map[uint64]string{ - ID: "identity", + IDENTITY: "identity", SHA1: "sha1", SHA2_256: "sha2-256", SHA2_512: "sha2-512", @@ -134,7 +136,7 @@ var Codes = map[uint64]string{ // DefaultLengths maps a hash code to it's default length var DefaultLengths = map[uint64]int{ - ID: -1, + IDENTITY: -1, SHA1: 20, SHA2_256: 32, SHA2_512: 64, diff --git a/sum.go b/sum.go index 249cb75..c68e160 100644 --- a/sum.go +++ b/sum.go @@ -167,7 +167,7 @@ func sumSHA3_224(data []byte, length int) ([]byte, error) { } func registerStdlibHashFuncs() { - RegisterHashFunc(ID, sumID) + RegisterHashFunc(IDENTITY, sumID) RegisterHashFunc(SHA1, sumSHA1) RegisterHashFunc(SHA2_512, sumSHA512) RegisterHashFunc(MD5, sumMD5)