+ h.names = append(h.names, name)
+ h.ins = append(h.ins, in)
+ h.outs = append(h.outs, out)
+ h.cmds = append(h.cmds, cmd)
+ }
+ return &h
+}
+
+func (h *Hasher) Write(p []byte) (n int, err error) {
+ h.wg.Add(len(h.names))
+ for _, in := range h.ins {
+ go func(in io.WriteCloser) {
+ if _, err := io.Copy(in, bytes.NewReader(p)); err != nil {
+ log.Fatalln(err)
+ }
+ h.wg.Done()
+ }(in)
+ }
+ h.wg.Wait()
+ return len(p), nil
+}
+
+func (h *Hasher) Sums() []meta4ra.Hash {
+ sums := make([]meta4ra.Hash, 0, len(h.names))
+ for i, name := range h.names {
+ if err := h.ins[i].Close(); err != nil {
+ log.Fatalln(err)