Skip to content
Discussion options

You must be logged in to vote

There were some bugs in your implementation:

  • you applied conversion.NativeToBytes on values which was already byte essentially (every frontend.Variable contained only a value of 8 bits). But the conversion function always pads to full field element length. A better approach if we already always know inputs are bytes is to use the uints.U8 primitive which automatically performs range checks and is compatible with binary hasher interface.
  • in prepareCircuitInputs you right padded file name with zeros, but in generateTargetHash you did not.

I rewrote your example to use mocked file system for consistency and fixed the errors. See below

package main

import (
	"crypto/rand"
	"crypto/sha256"
	"…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@triplewz
Comment options

Answer selected by triplewz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants