Skip to content

Commit

Permalink
chore: avoid magic numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed Dec 3, 2019
1 parent 08e15f8 commit 60ab0f8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cid.go
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ func PrefixFromBytes(buf []byte) (Prefix, error) {
}

func CidFromBytes(data []byte) (int, Cid, error) {
if len(data) > 2 && data[0] == 18 && data[1] == 32 {
if len(data) > 2 && data[0] == mh.SHA2_256 && data[1] == 32 {
if len(data) < 34 {
return 0, Undef, fmt.Errorf("not enough bytes for cid v0")
}
Expand Down

0 comments on commit 60ab0f8

Please # to comment.