Consensys / goff

goff (go finite field) is a unix-like tool that generates fast field arithmetic in Go.
https://hackmd.io/@zkteam/goff
Apache License 2.0
76 stars 12 forks source link

Template Errors for Primes Less than 256 bit #21

Closed actuallyachraf closed 4 years ago

actuallyachraf commented 4 years ago

When generating prime fields for primes less than 256 bit (128-bit or 192-bit) a template error (out of range index for slice) is returned at line 61:16 .

$ > goff -m 6277101735386680763835789423207666416102355444464034512659 -o ./fp192/ -p fp192 -e Element

running goff version v0.2.2

generating fp192/element.go                                                      

template: :61:16: executing "" at <index $.One $i>: error calling index: reflect: slice index out of range
goff -m 340282366920938463463374557953744961537 -o ./fp128/ -p fp192 -e Element

running goff version v0.2.2

generating fp128/element.go                                                      

template: :61:16: executing "" at <index $.One $i>: error calling index: reflect: slice index out of range
gbotrel commented 4 years ago

Just fixed that (https://github.com/ConsenSys/goff/commit/6a33dccb1448e44f5d94a1b2360207c281a43ee8) ; please update to goff v0.3.0 :-)