func (d *digest) Write(p []byte) (n int, err error) {
	n = len(p)
	d.data = append(d.data, p...)
	return
}
Write (via the embedded io.Writer interface) adds more data to the running hash.
It never returns an error.
package bls381
import (
	"hash"
	"math/big"
	"github.com/consensys/gurvy/bls381/fr"
	"golang.org/x/crypto/sha3"
)
const mimcNbRounds = 91
const BlockSize = 32
type Params []fr.Element
func NewParams(seed string) Params {
	res := make(Params, mimcNbRounds)
	rnd := sha3.Sum256([]byte(seed))
	value := new(big.Int).SetBytes(rnd[:])
	for i := 0; i < mimcNbRounds; i++ {
		rnd = sha3.Sum256(value.Bytes())
		value.SetBytes(rnd[:])
		res[i].SetBigInt(value)
	}
	return res
}
type digest struct {
	Params Params
	h      fr.Element
	data   []byte  
}
func NewMiMC(seed string) hash.Hash {
	d := new(digest)
	params := NewParams(seed)
	d.Params = params
	d.Reset()
	return d
}
func (d *digest) Reset() {
	d.data = nil
	d.h = fr.Element{0, 0, 0, 0}
}
func (d *digest) Sum(b []byte) []byte {
	buffer := d.checksum()
	d.data = nil  
	hash := buffer.Bytes()
	b = append(b, hash[:]...)
	return b
}
func (d *digest) Size() int {
	return BlockSize
}
func (d *digest) BlockSize() int {
	return BlockSize
}