From 2371ac726573e4f5c914bda227f8603b9b2129a3 Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 26 Jun 2016 12:07:46 +0200 Subject: [PATCH] swarm/storage: reset the base hash to SHA3. !!hard fork = no backward compatibility :) --- swarm/storage/chunker.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/swarm/storage/chunker.go b/swarm/storage/chunker.go index c3c4997b4f..d58eed6381 100644 --- a/swarm/storage/chunker.go +++ b/swarm/storage/chunker.go @@ -38,8 +38,8 @@ data_{i} := size(subtree_{i}) || key_{j} || key_{j+1} .... || key_{j+n-1} */ const ( - // defaultHash = "SHA3" // http://golang.org/pkg/hash/#Hash - defaultHash = "SHA256" // http://golang.org/pkg/hash/#Hash + defaultHash = "SHA3" // http://golang.org/pkg/hash/#Hash + // defaultHash = "SHA256" // http://golang.org/pkg/hash/#Hash defaultBranches int64 = 128 // hashSize int64 = hasherfunc.New().Size() // hasher knows about its own length in bytes // chunksize int64 = branches * hashSize // chunk is defined as this @@ -364,7 +364,8 @@ func (self *LazyChunkReader) join(b []byte, off int64, eoff int64, depth int, tr // glog.V(logger.Detail).Infof("[BZZ] depth: %v, len(b): %v, off: %v, eoff: %v, chunk.Size: %v, treeSize: %v", depth, len(b), off, eoff, chunk.Size, treeSize) if int64(len(b)) != eoff-off { //fmt.Printf("len(b) = %v off = %v eoff = %v", len(b), off, eoff) - panic("len(b) does not match") + msg := fmt.Sprintf("len(b) = %v =?= %v = eoff-off", len(b), eoff-off) + panic(msg) } copy(b, chunk.SData[8+off:8+eoff])