[#290] object/rangehash: Apply salt to data before hashing

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-01-11 16:50:49 +03:00 committed by Alex Vanin
parent 0e2c761481
commit 3a7f6701d8
2 changed files with 4 additions and 3 deletions

View file

@ -4,6 +4,7 @@ import (
"context" "context"
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/nspcc-dev/neofs-node/pkg/util"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -33,7 +34,7 @@ func (s *Service) GetRangeHash(ctx context.Context, prm RangeHashPrm) (*RangeHas
rngPrm.SetRange(rng) rngPrm.SetRange(rng)
rngPrm.SetChunkWriter(&hasherWrapper{ rngPrm.SetChunkWriter(&hasherWrapper{
hash: h, hash: util.NewSaltingWriter(h, prm.salt),
}) })
if err := s.GetRange(ctx, rngPrm); err != nil { if err := s.GetRange(ctx, rngPrm); err != nil {

View file

@ -2,7 +2,7 @@ package getsvc
import ( import (
"crypto/ecdsa" "crypto/ecdsa"
"hash" "io"
"github.com/nspcc-dev/neofs-api-go/pkg/client" "github.com/nspcc-dev/neofs-api-go/pkg/client"
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
@ -40,7 +40,7 @@ type partWriter struct {
} }
type hasherWrapper struct { type hasherWrapper struct {
hash hash.Hash hash io.Writer
} }
func NewSimpleObjectWriter() *SimpleObjectWriter { func NewSimpleObjectWriter() *SimpleObjectWriter {