Request to verify calculations for blake2b please


I have been reading over this thread:

and have been working on my own implementation of a miner.

I have come to the point of actually calculating the hashes for the compiled units of work received from the stratum server. I have tested my calculation engine against the “classic” rfc7693 calculation and result for “abc.” Everything checks out. I have also compiled and done a few checks against this implementation:

Things check out there as well, until I get to calculating the full hash on the 144-byte work (represented by the 288-byte string). At that point things seem to diverge, and I was wondering whether someone would be willing to check my results.

As a start, I need to ask one question. Am I correct in understanding that what I am processing will be the 144 bytes once the string is converted from hex to a byte array (i.e. the string “04000000” would be the bytes 0x04, 0x00, 0x00, 0x00)? Or am I supposed to process the string directly converted to bytes, in which case the previous example would become 0x30, 0x34, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30? The second option wouldn’t seem likely to me as the specification calls for a 144 byte work segment, and that would produce a 288 byte segment. I just wanted to make sure, though.

Anyway, for this input:


I receive:


using the first method (converting to a 144-byte work chunk) or:


parsing the string byte for byte.

Do either of these results look correct?

Thank you in advance.

yes, all binary manipulations are going on bytes, definitely not on “hex string read by bytes”.

sorry, not quite clear what are you doing here.

for Blake2B ZCash-style hash of that 144 bytes I get:


Thank you. That agrees with what is listed in the discussion that I quoted previously. Obviously there is an error in my algorithm that I will have to track down. Your verification helps me to confirm that.

You may find paragraph 2.8 and paragraph useful to get what “Zcash-style” means here for Blake2B, since RFC 7693 paragraph 2.5 does not specify these Zcash’ details.

Thank you. I will look into those.

If I read 2.3 of, am I to understand that I should be using both f0 and f1 as end indicators?

Okay, so think I’ve answered my own question. I went digging around in the nheqminer source and it would appear that no, f1 is not needed. With the last flag, just xor 0xFFFFFFFFFFFFFFFF with v[14] and that is sufficient.