Closed KimiWu123 closed 4 years ago
Hi, sorry for the late response!
The inputs are bit representation of each byte, in a "little-endian" fashion - least significant bit first, most significant bit last.
There is currently a bug that makes the circuit work only for multiples of 512. It's fixed in a Semaphore version that we'll release soon.
To give an example of a hex to bits conversion, where we look at "little endian" bit decompositions of numbers: A = 0101 B = 1101 C = 0011 D = 1011
0xABCD -> 11010101 10110011
This will not work due to the bug, so you can test this input in Python 3:
import hashlib
hashlib.blake2s(b'\xFF'*64 + b'\x00'*64).digest().hex()
corresponds to 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Great! looking forward to your fix. Many thanks!
@KimiWu123 Just to be clear, you can already use it if you want :) Just make sure your inputs are padded to be multiples of 512 bits.
Here is what I did, firstly, using the sample code in
test/circuits/blake2s/blake2s.js
. For the input, got hash value,
0xc8a7a6e87d10557e3214979b2dda05b16a0e845a7367bcacb1890bfed50aaa97
, as expected in the test case.Secondly, using golang lib to generate blake2s hash and run the above example. The same input and got the same output.
Thirdly, change the input to
the result hash of blake2s in my golang tool is
but the output of circom
blake2s
isI don't understand what's wrong. I run many cases, 256/512/1024 bits length input, just not matching the output of circom
blake2s
. I also used nodejs(libblakejs
) to calculate the hashes of blake2s and got the same result as golang version. Could you help check what happened? Stuck here for many days. Thanks.