Replies: 1 comment 2 replies
-
So, you have a type Circuit struct {
Input []uints.U8
}
func (c *Circuit) Define(api frontend.API) error {
hasher, err := sha2.New(api)
if err != nil { return err }
hasher.Write(c.Inputs....)
....
return nil
}
func main() {
var byteInput []byte
// read byteInput from file etc ....
compiledCircuit := &Circuit{
Inputs: make([]uints.U8, len(byteInput))
}
// compile circuit ....
assignment := &Circuit{
Inputs: uints.NewU8Array(byteInput)
}
// generate proof ...
} Would your usecase be different? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
There is a scenario similar to something like Tornado, where I need to calculate the original value of cm, with cm = hash(k, r). Here, the hash function uses the write() method from gnark/std/hash/sha2(code below), which only accepts the []uint8 type. What type of public parameters should k and r use? If they are of the frontend.Variable type, how can they be converted to []uint8?
func (d *digest) Write(data []uints.U8) {
d.in = append(d.in, data...)
}
Beta Was this translation helpful? Give feedback.
All reactions