[#170] checksum: Do not use pointers

Do not return pointers from getters. Do not pass pointers to the methods
that does not modify the checksum. Add `Empty` method.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-03-04 14:38:23 +03:00 committed by LeL
parent fd13e61266
commit caa055236b
7 changed files with 53 additions and 35 deletions

View file

@ -20,11 +20,11 @@ var errIncorrectID = errors.New("incorrect object identifier")
// CalculatePayloadChecksum calculates and returns checksum of
// object payload bytes.
func CalculatePayloadChecksum(payload []byte) *checksum.Checksum {
func CalculatePayloadChecksum(payload []byte) checksum.Checksum {
var res checksum.Checksum
checksum.Calculate(&res, checksum.SHA256, payload)
return &res
return res
}
// CalculateAndSetPayloadChecksum calculates checksum of current