github.com/consensys/gnark-crypto@v0.14.0/internal/generator/crypto/hash/mimc/generate.go (about)

     1  package mimc
     2  
     3  import (
     4  	"os"
     5  	"path/filepath"
     6  
     7  	"github.com/consensys/bavard"
     8  	"github.com/consensys/gnark-crypto/internal/generator/config"
     9  )
    10  
    11  func Generate(conf config.Curve, baseDir string, bgen *bavard.BatchGenerator) error {
    12  
    13  	conf.Package = "mimc"
    14  	entries := []bavard.Entry{
    15  		{File: filepath.Join(baseDir, "doc.go"), Templates: []string{"doc.go.tmpl"}},
    16  		{File: filepath.Join(baseDir, "mimc.go"), Templates: []string{"mimc.go.tmpl"}},
    17  		{File: filepath.Join(baseDir, "options.go"), Templates: []string{"options.go.tmpl"}},
    18  	}
    19  	os.Remove(filepath.Join(baseDir, "utils.go"))
    20  	os.Remove(filepath.Join(baseDir, "utils_test.go"))
    21  
    22  	return bgen.Generate(conf, conf.Package, "./crypto/hash/mimc/template", entries...)
    23  
    24  }