From 5d7650c3e766fa457d20c663ab42afdd514a2b07 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 23 Aug 2022 20:59:21 +0300 Subject: [PATCH] [#323] client: Use checksum parameter directly in `object.Hash` Signed-off-by: Evgenii Stratonikov --- client/object_hash.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client/object_hash.go b/client/object_hash.go index 0b0e047e..03b5f69b 100644 --- a/client/object_hash.go +++ b/client/object_hash.go @@ -24,7 +24,7 @@ type PrmObjectHash struct { body v2object.GetRangeHashRequestBody - tillichZemor bool + csAlgo v2refs.ChecksumType addr v2refs.Address } @@ -101,7 +101,7 @@ func (x *PrmObjectHash) SetRangeList(r ...uint64) { // // By default, SHA256 hash function is used. func (x *PrmObjectHash) TillichZemorAlgo() { - x.tillichZemor = true + x.csAlgo = v2refs.TillichZemor } // UseSalt sets the salt to XOR the data range before hashing. @@ -170,10 +170,10 @@ func (c *Client) ObjectHash(ctx context.Context, prm PrmObjectHash) (*ResObjectH } prm.body.SetAddress(&prm.addr) - if prm.tillichZemor { - prm.body.SetType(v2refs.TillichZemor) - } else { + if prm.csAlgo == v2refs.UnknownChecksum { prm.body.SetType(v2refs.SHA256) + } else { + prm.body.SetType(prm.csAlgo) } var req v2object.GetRangeHashRequest