forked from TrueCloudLab/frostfs-node
[#1558] node: Do not put SHA256 hash as homomorphic
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
33676ad832
commit
1684cd63fa
1 changed files with 7 additions and 6 deletions
|
@ -9,6 +9,7 @@ import (
|
||||||
"github.com/nspcc-dev/neofs-sdk-go/checksum"
|
"github.com/nspcc-dev/neofs-sdk-go/checksum"
|
||||||
"github.com/nspcc-dev/neofs-sdk-go/object"
|
"github.com/nspcc-dev/neofs-sdk-go/object"
|
||||||
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
|
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
|
||||||
|
"github.com/nspcc-dev/tzhash/tz"
|
||||||
)
|
)
|
||||||
|
|
||||||
type payloadSizeLimiter struct {
|
type payloadSizeLimiter struct {
|
||||||
|
@ -153,17 +154,17 @@ func payloadHashersForObject(obj *object.Object, withoutHomomorphicHash bool) []
|
||||||
|
|
||||||
if !withoutHomomorphicHash {
|
if !withoutHomomorphicHash {
|
||||||
hashers = append(hashers, &payloadChecksumHasher{
|
hashers = append(hashers, &payloadChecksumHasher{
|
||||||
hasher: sha256.New(),
|
hasher: tz.New(),
|
||||||
checksumWriter: func(binChecksum []byte) {
|
checksumWriter: func(binChecksum []byte) {
|
||||||
if ln := len(binChecksum); ln != sha256.Size {
|
if ln := len(binChecksum); ln != tz.Size {
|
||||||
panic(fmt.Sprintf("wrong checksum length: expected %d, has %d", sha256.Size, ln))
|
panic(fmt.Sprintf("wrong checksum length: expected %d, has %d", tz.Size, ln))
|
||||||
}
|
}
|
||||||
|
|
||||||
csSHA := [sha256.Size]byte{}
|
csTZ := [tz.Size]byte{}
|
||||||
copy(csSHA[:], binChecksum)
|
copy(csTZ[:], binChecksum)
|
||||||
|
|
||||||
var cs checksum.Checksum
|
var cs checksum.Checksum
|
||||||
cs.SetSHA256(csSHA)
|
cs.SetTillichZemor(csTZ)
|
||||||
|
|
||||||
obj.SetPayloadHomomorphicHash(cs)
|
obj.SetPayloadHomomorphicHash(cs)
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue