Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
12 changes: 11 additions & 1 deletion digest.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
//
// The following is an example of the contents of Digest types:
//
// sha256:7173b809ca12ec5dee4506cd86be934c4596dd234ee82c0662eac04a8c2c71dc
// sha256:7173b809ca12ec5dee4506cd86be934c4596dd234ee82c0662eac04a8c2c71dc
//
// This allows to abstract the digest behind this type and work only in those
// terms.
Expand Down Expand Up @@ -146,6 +146,16 @@ func (d Digest) String() string {
return string(d)
}

// IsIdenticalTo compares this digest to any other, inclusive of the hashing algorithm used
func (d Digest) IsIdenticalTo(o Digest) bool {
return string(d) == string(o)
}

// IsEmpty does what it says (an empty digest is an empty string)
func (d Digest) IsEmpty() bool {
return len(d) == 0
}

func (d Digest) sepIndex() int {
i := strings.Index(string(d), ":")

Expand Down