diff --git a/pkg/checksum.go b/pkg/checksum.go index 4182b71..72087a7 100644 --- a/pkg/checksum.go +++ b/pkg/checksum.go @@ -37,8 +37,8 @@ func NewChecksum() *Checksum { return NewChecksumFromV2(new(refs.Checksum)) } -// GetType returns checksum type. -func (c *Checksum) GetType() ChecksumType { +// Type returns checksum type. +func (c *Checksum) Type() ChecksumType { switch (*refs.Checksum)(c).GetType() { case refs.SHA256: return ChecksumSHA256 @@ -49,8 +49,8 @@ func (c *Checksum) GetType() ChecksumType { } } -// GetSum returns checksum bytes. -func (c *Checksum) GetSum() []byte { +// Sum returns checksum bytes. +func (c *Checksum) Sum() []byte { return (*refs.Checksum)(c).GetSum() } @@ -75,7 +75,7 @@ func (c *Checksum) ToV2() *refs.Checksum { } func EqualChecksums(cs1, cs2 *Checksum) bool { - return cs1.GetType() == cs2.GetType() && bytes.Equal(cs1.GetSum(), cs2.GetSum()) + return cs1.Type() == cs2.Type() && bytes.Equal(cs1.Sum(), cs2.Sum()) } // Marshal marshals Checksum into a protobuf binary form. diff --git a/pkg/checksum_test.go b/pkg/checksum_test.go index 9d402a4..41cc9d3 100644 --- a/pkg/checksum_test.go +++ b/pkg/checksum_test.go @@ -25,8 +25,8 @@ func TestChecksum(t *testing.T) { c.SetSHA256(cSHA256) - require.Equal(t, ChecksumSHA256, c.GetType()) - require.Equal(t, cSHA256[:], c.GetSum()) + require.Equal(t, ChecksumSHA256, c.Type()) + require.Equal(t, cSHA256[:], c.Sum()) cV2 := c.ToV2() @@ -38,8 +38,8 @@ func TestChecksum(t *testing.T) { c.SetTillichZemor(cTZ) - require.Equal(t, ChecksumTZ, c.GetType()) - require.Equal(t, cTZ[:], c.GetSum()) + require.Equal(t, ChecksumTZ, c.Type()) + require.Equal(t, cTZ[:], c.Sum()) cV2 = c.ToV2()