Skip to content

Commit

Permalink
rename ID to IDENTITY and alias
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed Aug 8, 2019
1 parent 0907336 commit eb87687
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion io_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
10 changes: 6 additions & 4 deletions multihash.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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",
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion sum.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit eb87687

Please sign in to comment.