code: func (h *Hasher) Write(b []byte) (int, error) {
  	l := len(b)
  	if l == 0 || l > h.pool.Size {
  		return 0, nil
  	}
  	t := h.getTree()
  	secsize := 2 * h.pool.SegmentSize
  	// calculate length of missing bit to complete current open section
  	smax := secsize - t.offset
  	// if at the beginning of chunk or middle of the section
  	if t.offset < secsize {
  		// fill up current segment from buffer
  		copy(t.section[t.offset:], b)
  		// if input buffer consumed and open section not complete, then
  		// advance offset and return
  		if smax == 0 {
  			smax = secsize
  		}
  		if l <= smax {
  			t.offset += l
  			return l, nil
  		}
  	} else {
  		// if end of a section
  		if t.cursor == h.pool.SegmentCount*2 {
  			return 0, nil
  		}
  	}
  	// read full sections and the last possibly partial section from the input buffer
  	for smax < l {
  		// section complete; push to tree asynchronously
  		go h.writeSection(t.cursor, t.section, true, false)
  		// reset section
  		t.section = make([]byte, secsize)
  		// copy from input buffer at smax to right half of section
  		copy(t.section, b[smax:])
  		// advance cursor
  		t.cursor++
  		// smax here represents successive offsets in the input buffer
  		smax += secsize
  	}
  	t.offset = l - smax + secsize
  	return l, nil
  }
docs: // methods needed to implement the SwarmHash and the io.Writer interfaces
  // Write calls sequentially add to the buffer to be hashed,
  // with every full segment calls writeSection in a go routine